View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
denise denise is offline
external usenet poster
 
Posts: 112
Default Convert Text to Numbers in a Macro

Expect a bucket load of prayers :o))))))))

"Allllen" wrote:

How long this takes will depend how many cells you have with values in.
It took me 25 seconds to process for one column with all 65536 rows, on a p4
1800 with 500mb memory. You can cut that by using For each rg in
Range("A1:A1000"), for example.

Sub TryThis()

Application.ScreenUpdating = False
Dim rg As Range

For Each rg In Range("A:A")

If rg.Value < "" Then
rg.NumberFormat = "General"
rg.Value = rg.Value
End If

Next rg
Application.ScreenUpdating = True

End Sub

I am looking forward to hearing those monks.
Alternatively you could be very nice and give me a little green tick :-)
--
Allllen


"Denise" wrote:

Hi! I have a data dump I am running several macros on. One macro I would
love to run is to convert a column of text numbers to numerical.

Excel does recognize them - I get the little green tirangle. But anyone who
uses Excel XP or 2003 (which I do) knows that formatting does NOT work.
Conversion must be done using that Smart Tag option.

However, the smart tag action does not get recorded in a macro. Microsoft
gave us a wonderful new feature and then didn't let us record it and make
life alittle easier.

So, if anyone can help me find a way to get this action recorded into the
macro, I would be forever grateful and even have monks pray for you.