phantom1975
MrExcel MVP
- Joined
- Jun 3, 2002
- Messages
- 3,962
I have the following:
Private Sub CommandButton1_Click()
Dim TransAmt as Long
TransAmt = InputBox("Enter Amount","Enter Amount","1234")
If TransAmt = "" Then
Exit Sub
End If
MsgBox "Your amount is " & TransAmt
End Sub
I get an error message when the CANCEL button is clicked. I'm certain that is because I have the variable set as LONG instead of STRING. What else can I do other than change the data type?
I've also tried:
If TransAmt = vbCancel Then
Exit Sub
And that doesn't work either. I even thought I had seen something like:
If Cancel = True Then
But that didn't do the trick either.
_________________
Pass on what you have learned. Support this great website by clicking on the sponsor's ads!.
This message was edited by phantom1975 on 2002-08-22 23:53
This message was edited by phantom1975 on 2002-08-23 00:21
Private Sub CommandButton1_Click()
Dim TransAmt as Long
TransAmt = InputBox("Enter Amount","Enter Amount","1234")
If TransAmt = "" Then
Exit Sub
End If
MsgBox "Your amount is " & TransAmt
End Sub
I get an error message when the CANCEL button is clicked. I'm certain that is because I have the variable set as LONG instead of STRING. What else can I do other than change the data type?
I've also tried:
If TransAmt = vbCancel Then
Exit Sub
And that doesn't work either. I even thought I had seen something like:
If Cancel = True Then
But that didn't do the trick either.
_________________
Pass on what you have learned. Support this great website by clicking on the sponsor's ads!.
This message was edited by phantom1975 on 2002-08-22 23:53
This message was edited by phantom1975 on 2002-08-23 00:21