This should be easy, but I can't for the life of me figure it out. I have a workbook with 20 sheets, and column C in all of the sheets contain numbers that are stored as text. I want to loop through each sheet, define the max rows in column C as a variable, then convert C2:Cvariable from text to number. My code works on a single sheet, but won't loop through all of them. What's missing?
I appreciate any help!
Code:
Sub Convert()
Dim NumRows As Long
Dim i As Long
Dim v As Variant
For Each WS In ActiveWorkbook.Worksheets
NumRows = Cells(Rows.Count, "C").End(xlUp).Row
For i = 2 To NumRows
For Each v In Array("C")
If Range(v & i) <> "" Then
Range(v & i).Value = Val(Range(v & i).Value)
End If
Next
Next
Next WS
End Sub
I appreciate any help!