hi guys
i am trying to make input box just number only
i get an error with if with an end if
can u guys point me what is wrong with the code?
error1 is for detecting when the customer click an cancel so there is no typemissmatch error
thx
i am trying to make input box just number only
Code:
Private Sub CommandButton3_Click()
Dim firstnumber As Integer
Dim lastnumber As Integer
Dim i As Integer
On Error GoTo error1
firstnumber = InputBox("Input the first number")
If Not IsNumeric(firstnumber) Then
MsgBox ("Number Only")
Else
lastnumber = InputBox("Masukan No Akhir yang Akan di Print")
If Not IsNumeric(lastnumber) Then
MsgBox ("Number Only")
Else
For i = firstnumber To lastnumber
Workbooks("ASDASD.xlsm").Activate
Worksheets("Sheet1").Range("Q4").Value = i
Range("B2:N27").PrintOut
Application.Wait (Now + TimeValue("00:00:10"))
Next i
End If
error1:
Exit Sub
End Sub
i get an error with if with an end if
can u guys point me what is wrong with the code?
error1 is for detecting when the customer click an cancel so there is no typemissmatch error
thx