I'm trying to convert numbers that have been stored in text to numbers on multiple worksheets. My issue is that the code I've cobbled together seems to be taking an inordinate amount of time. I'm using a For Each statement that loops through the necessary worksheets and ranges. It doesn't crash Excel, it just keeps running seemingly forever.
Sub ConvertTextToNumber()
Application.ScreenUpdating = False
Dim WshtNames As Variant
Dim WshtNameCrnt As Variant
Dim r As Range
WshtNames = Array("Financial Data", "Site Data ", "Org Data", "Program Data")
For Each WshtNameCrnt In WshtNames
On Error Resume Next
For Each r In Worksheets(WshtNameCrnt).UsedRange.SpecialCells(xlCellTypeConstants)
If IsNumeric(r) Then r.Value = Val(r.Value)
Next
Next
Application.ScreenUpdating = False
End Sub
When I stop the script from running and click Debug, it seems to be getting caught up at the first Next statement. I think that the method I'm using to convert the values is simply more time intensive than necessary, and thus running it on multiple sheets is even worse.
I'm open to any and all suggestions to make this process run faster. Thanks in advance!