Test for Inputbox cancel

C

Cosmic

I want to cleanly ignore the cancel of an Inputbox. I'm using a Select Case,
but don't know how to test for cancel/null from Inputbox.
How do I test for cancel button?

Select Case astring = InputBox("Enter amount for each payment: ",
"Calculate Number of Payments")
Case Is > 0
' Do some code here...
Case "" '<= This produces Error 13 Type mismatch????
'Cancel button pressed, no change
MsgBox "cancel pressed"
Case Else 'Entered illegal or negative number
MsgBox "Enter a number greater than 0 for the amount for each
payment"
End Select
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top