Macros & "Convert to Number"

S

Scott Huerta

I have a spreadsheet created by another application and the numeric fields
are being treated as text fields.

I can manually select the "Convert to Number" from the popup menu. But I
need to do it via a macro.

When I try to use a macro the "Convert to Number" action does not appear to
be recorded. How can I do this using a macro.

Thanks in advance,
 
J

Jacob Skaria

Try the below

Sub Macro3()
Dim rngTemp As Range
Set rngTemp = ActiveSheet.UsedRange
rngTemp.NumberFormat = "General"
End Sub

If this post helps click Yes
 
J

Jacob Skaria

Oops...small correction.

Sub Macro3()
Dim rngTemp As Range, varRange As Variant
Set rngTemp = ActiveSheet.UsedRange
varRange = rngTemp.Value
rngTemp.NumberFormat = "General"
rngTemp.Value = varRange
End Sub

If this post helps click Yes
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top