Results 1 to 10 of 117

Thread: Tests and Notes on Range objects in Excel Cell

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    10,457
    Rep Power
    10
    Number stored as text, alignment of numeric values in cells

    Improved/ Extended Evaluate Range solution.

    Based on all the posts so far on this page, we have got this far,
    Code:
    Sub Number_stored_as_text()  '    https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21967&viewfull=1#post21967
    Dim Ws1 As Worksheet, Rng As Range
     Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
     Set Rng = Ws1.Range("A1:F7")
    Dim strEval As String
     Let strEval = "=1*" & Rng.Address & ""
    Debug.Print strEval '  gives =1*$A$1:$F$7
    
     Let Rng.Offset(0, Rng.Columns.Count + 1).Value = Evaluate(strEval)
    End Sub
    This is our test data, https://i.postimg.cc/KvhPVN44/Test-Data.jpg
    https://i.postimg.cc/8PkRNCBV/Test-Data.jpg
    Attachment 5116
    _____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
    Row\Col A B C D E F
    1 Page Letter ordernr Quant Cost Cost/quant
    2 11 22 33 44 55
    3 11 22 33 44 55
    4 55 44 33 22 11 0,5
    5 55 44 33 22 11 0,5
    6 44 Y 23457 34 60,7 1,7568741
    7 55 X 2234 34 160,7 4,60458453
    Worksheet: Sheet1

    This is the result after running the macro

    _____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
    Row\Col A B C D E F G H I J K L M
    1 Page Letter ordernr Quant Cost Cost/quant #WERT! #WERT! #WERT! #WERT! #WERT! #WERT!
    2 11 22 33 44 55 11 22 33 44 55 0
    3 11 22 33 44 55 11 22 33 44 55 0
    4 55 44 33 22 11 0,5 55 44 33 22 11 0,5
    5 55 44 33 22 11 0,5 55 44 33 22 11 0,5
    6 44 Y 23457 34 60,7 1,7568741 44 #WERT! 23457 34 60,7 1,756874
    7 55 X 2234 34 160,7 4,60458453 55 #WERT! 2234 34 160,7 4,604585
    Worksheet: Sheet1



    Oh bollox, a couple of problems
    We see a couple of problems. An empty cell comes out as a 0 in the output, and text in any cell results in an error in the output.

    In the next post, we look at overcoming these two problems
    Attached Images Attached Images

Similar Threads

  1. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 03-26-2025, 02:56 AM
  2. Replies: 116
    Last Post: 02-23-2025, 12:13 AM
  3. Tests and Notes on Range Referrencing
    By DocAElstein in forum Test Area
    Replies: 70
    Last Post: 02-20-2024, 01:54 AM
  4. Tests and Notes for EMail Threads
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 11-15-2022, 04:39 PM
  5. Notes tests. Excel VBA Folder File Search
    By DocAElstein in forum Test Area
    Replies: 39
    Last Post: 03-20-2018, 04:09 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •