How to differentiate the action when a user hit CANCEL button or OK button under a Inputbox.
There are two scenarios:
1. To end (Exit Sub) the operation when user hit Cancel/Close button
2. If user hit OK without any value ask him to enter some value.
The code i use satisfy 2nd scenario, is it possible to accommodate 1st scenario as well?
Sub INPUT_BOX()
Re_Enter_Username:
cUsername = INPUTBOX("Username", "Please provide Login Name")
If cUsername = "" Then
MsgBox "Please provide a Username"
GoTo Re_Enter_Username:
Else 'Code if not empty
End If
End Sub
I am not sure whether this is possible, may be my exception was more than what VBA can help provide. :) Sorry if so.
And thanks if you have a solution for this.