B
Big Chris
Please can anyone help....
I have a button that a user clicks on which brings up a validation cod
box....a vb input box.
Everything seems to work perfectly except if the user clicks o
'cancel' or the red cross to close the box. In this case it interrupt
the macro revealing a sheet which should be 'veryhidden'!!
Would anyone know what code I need to cause clicks on the Cancel o
Red cross to just close the input box and finish the macro??
I feel like I may just be missing a single line of code or somethin
but I'm new to vb and just can't find it.
The code I am using is below.
Many thanks,
------------------------------------------------------------------------
Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.EnableCancelKey = xlDisabled
MyNum = InputBox("Please enter your 8 digit validation code")
Sheets("Sheet1").Visible = True
Sheets("Sheet1").Select
If CLng(MyNum) = Worksheets("Sheet1").Range("A3").Value Then
Application.OnTime Now, "Deletebutton"
Else
MsgBox "Number is incorrect"
End If
Sheets("Sheet1").Select
Range("A1").Value = MyNum
Sheets("Sheet1").Visible = xlSheetVeryHidden
Sheets("Setup Sheet").Select
End Su
I have a button that a user clicks on which brings up a validation cod
box....a vb input box.
Everything seems to work perfectly except if the user clicks o
'cancel' or the red cross to close the box. In this case it interrupt
the macro revealing a sheet which should be 'veryhidden'!!
Would anyone know what code I need to cause clicks on the Cancel o
Red cross to just close the input box and finish the macro??
I feel like I may just be missing a single line of code or somethin
but I'm new to vb and just can't find it.
The code I am using is below.
Many thanks,
------------------------------------------------------------------------
Sub CommandButton1_Click()
Application.ScreenUpdating = False
Application.EnableCancelKey = xlDisabled
MyNum = InputBox("Please enter your 8 digit validation code")
Sheets("Sheet1").Visible = True
Sheets("Sheet1").Select
If CLng(MyNum) = Worksheets("Sheet1").Range("A3").Value Then
Application.OnTime Now, "Deletebutton"
Else
MsgBox "Number is incorrect"
End If
Sheets("Sheet1").Select
Range("A1").Value = MyNum
Sheets("Sheet1").Visible = xlSheetVeryHidden
Sheets("Setup Sheet").Select
End Su