im only new to vba so i dont really know much about programming, anyway, i created a macro that adds a zero before a single digit string number in my selection, it only works if my selections are single digits only but doesn't work when theres a double digits or more in my selection, this is my code:
Sub AddZero()
Dim cell As Range
For Each cell In Selection
If Not IsNumeric(cell) = False And cell > 10 Then
Exit Sub
Else:
cell = "0" & cell
End If
Next
End Sub
How can i make my macro skip all cells with double digits and only target single digits, pls help and thanks very much in advance.


If IsNumeric(cell) And cell < 10 Then cell.Value = "0" & cell.Value