Macros & "Convert to Number"

  • Thread starter Thread starter Scott Huerta
  • Start date Start date
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,
 
Try the below

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

If this post helps click Yes
 
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
 
Back
Top