I tried to covert the text to number under range A:A for every worksheet in the workbook using some vba code.
Capture.PNG
Did some search online and this is my current code:
Sub Convert_Text_To_Number()
Dim Sh As Worksheet
For Each Sh In ThisWorkbook.Worksheets
If Sh.Visible = True Then Sh.Activate
Dim rBig As Range, r As Range, v As Variant
Set rBig = Range("A:A")
For Each r In rBig
v = r.Value
If Not IsError(v) Then
If v <> "" And r.HasFormula = False Then
If IsNumeric(v) Then
r.Clear
r.Value = v
End If
End If
End If
Next r
Next Sh
End Sub
The code works but every time it runs, it freezes the excel for quite a few seconds. I think something might be wrong or the code can be simplified?
Please help take a look and suggest some better solution.
Thank you very much
Ken
Bookmarks