ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Input Box Cancel (https://www.excelbanter.com/excel-discussion-misc-queries/202562-input-box-cancel.html)

jase

Input Box Cancel
 
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

Jim Thomlinson

Input Box Cancel
 
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
--
HTH...

Jim Thomlinson


"Jase" wrote:

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


Gord Dibben

Input Box Cancel
 
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

On Mon, 15 Sep 2008 11:54:01 -0700, Jase
wrote:

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




All times are GMT +1. The time now is 03:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com