Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert text to numbers
Hello all,
When working in XL and it finds numbers stored as text, a smart tag pops up letting you convert the text to numbers. I'm assuming there is a way to do this programatically.......maybe something like a "ConverTextToNumbers" method.......yes/no/maybe??? Thanks for any help anyone can provide, Conan Kelly |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert text to numbers
try this macro:
Sub numerify() Dim r As Range Count = 0 For Each r In ActiveSheet.UsedRange If Application.IsText(r.Value) Then If IsNumeric(r.Value) Then r.Value = 1# * r.Value r.NumberFormat = "General" Count = Count + 1 End If End If Next MsgBox (Count & " cells changed") End Sub -- Gary''s Student - gsnu200761 "Conan Kelly" wrote: Hello all, When working in XL and it finds numbers stored as text, a smart tag pops up letting you convert the text to numbers. I'm assuming there is a way to do this programatically.......maybe something like a "ConverTextToNumbers" method.......yes/no/maybe??? Thanks for any help anyone can provide, Conan Kelly |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert text to numbers
Conan,
Here's an example: Sub test() Set ws = ActiveSheet Set r = ws.Range("A:B").SpecialCells(xlCellTypeConstants) For Each rr In r If IsNumeric(rr.Value) Then rr.NumberFormat = "General" rr.Value = rr.Value End If Next End Sub -- Dan On Dec 7, 3:44 pm, "Conan Kelly" wrote: Hello all, When working in XL and it finds numbers stored as text, a smart tag pops up letting you convert the text to numbers. I'm assuming there is a way to do this programatically.......maybe something like a "ConverTextToNumbers" method.......yes/no/maybe??? Thanks for any help anyone can provide, Conan Kelly |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Convert text to numbers
Gary's Student,
Thanks for the help. I would have though that there would have been some method part of the Error object that would have done that automatically. Guess not!!! That would be too easy!!! Thanks again for all of your help, Conan "Gary''s Student" wrote in message ... try this macro: Sub numerify() Dim r As Range Count = 0 For Each r In ActiveSheet.UsedRange If Application.IsText(r.Value) Then If IsNumeric(r.Value) Then r.Value = 1# * r.Value r.NumberFormat = "General" Count = Count + 1 End If End If Next MsgBox (Count & " cells changed") End Sub -- Gary''s Student - gsnu200761 "Conan Kelly" wrote: Hello all, When working in XL and it finds numbers stored as text, a smart tag pops up letting you convert the text to numbers. I'm assuming there is a way to do this programatically.......maybe something like a "ConverTextToNumbers" method.......yes/no/maybe??? Thanks for any help anyone can provide, Conan Kelly |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
convert numbers stored as numbers to text | Excel Worksheet Functions | |||
Convert numbers stored as text to numbers Excel 2000 | Excel Discussion (Misc queries) | |||
How do I convert numbers stored as text with spaces to numbers | Excel Discussion (Misc queries) | |||
How to convert Excel imported numbers from text to numbers? | Excel Discussion (Misc queries) |