Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 419
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 419
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
convert numbers stored as numbers to text GemmaEiduks Excel Worksheet Functions 3 July 24th 06 09:02 PM
Convert numbers stored as text to numbers Excel 2000 Darlene Excel Discussion (Misc queries) 6 January 31st 06 08:04 PM
How do I convert numbers stored as text with spaces to numbers Baffuor Excel Discussion (Misc queries) 1 May 24th 05 07:39 AM
How to convert Excel imported numbers from text to numbers? Alden Excel Discussion (Misc queries) 9 April 1st 05 09:51 PM


All times are GMT +1. The time now is 12:17 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"