I have a table in an excel spreadsheet. In this table I would like to go from columns AP2 : AW2 and run down the rows to the end of the table and perform 2 actions. One I would like to convert the cell values from text to number. Second I would divide each cell by 100. So far my code contains two macros that trigger when hitting Ctrl n. They work but is hardcoded to row 2000 rather than finding the end of the table (sometimes the table could have more or less than 2000 lines). I also don't think having two macros is probably all that efficient. Any help on this would be greatly appreciated!
Sub Number_Conversion()
'Convert text to number
With Sheet1.Range("AP2:AW2000")
.NumberFormat = "Number"
.Value = .Value
End With
End Sub
Sub Divide_By()
'Divide number by 100
'declare variables
Dim ws As Worksheet
Dim rng As Range
Dim myVal As Range
Set ws = Sheet1
Set rng = ws.Range("AP2:AW2000")
For Each myVal In rng
If myVal.Value > 0 Then
myVal = myVal.Value / 100
End If
Next myVal
End Sub