Input Box Cancel

  • Thread starter Thread starter Jase
  • Start date Start date
J

Jase

I am using an input box, when i select the cancel button on my input box it
gives me a debug. Do I need to code this button to cancel? if so how?

thanks,

Jase
 
Try code something like this... it allows only numbers in the input box and
validates for numbers less than 1...

Sub test()
Dim var As Variant

var = Application.InputBox("please enter the number of sheets.", Type:=1)

If var < 1 Then
MsgBox "Won't print"
Else
MsgBox "Print " & var & " copies"
End If

End Sub
 
Num = InputBox("Enter a number ")
If Num = "" Or Not IsNumeric(Num) Then
MsgBox "you have cancelled or not entered a valid number"
End If


Gord Dibben MS Excel MVP
 

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

Similar Threads


Back
Top