The following code works as desired except it requires a leading zero for numbers 1 9
The problem without leading zero is it doesnt add 1 to the numbers 10 plus as it does when a leading zero 01 - 09
Why does it happen?
Can anyone provide a better solution than my initial default value zero (0) in the textbox (which then needs to be left in the textbox).
Sample worksheet of relevant portion attached
The problem without leading zero is it doesnt add 1 to the numbers 10 plus as it does when a leading zero 01 - 09
Why does it happen?
Can anyone provide a better solution than my initial default value zero (0) in the textbox (which then needs to be left in the textbox).
Code:
Private Sub CommandButton1_Click()
Application.Calculation = xlCalculationManual
' Transfer the create a gap number to test indicators
Range("J68") = TextBox1.Text
' Select the start of range requiring possible alteration.
Range("E69").Select
' Add 1 to each if greater than the textbox entry.
Do While ActiveCell.Value <> Empty
If ActiveCell.Value > TextBox1.Text Then
ActiveCell.Value = ActiveCell.Value + 1
Else
End If
ActiveCell.Offset(1, 0).Select
Loop
Application.Calculation = xlCalculationAutomatic
End Sub