Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
How do I trap a Cancel event on the following code? I have tried the most
common IF statements however, the code blows up before getting to the IF statement when CANCEL is clicked. Set rng = Application.InputBox(Msg1, Title1, Type:=8) |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
hi
if the user clicks cancel, the input box returns a zero length string. something like this might work..... if return = "" then msgbox "nothing entered?!?!" exit sub '?? end if play with it. regards FSt1 "Rafi" wrote: How do I trap a Cancel event on the following code? I have tried the most common IF statements however, the code blows up before getting to the IF statement when CANCEL is clicked. Set rng = Application.InputBox(Msg1, Title1, Type:=8) |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try
Dim rng As Range On Error Resume Next Set rng = Application.InputBox(Prompt:=msg1, Title:=title1, Type:=8) On Error GoTo 0 If rng Is Nothing Then MsgBox "User Cancelled" Exit Sub End If ' Do lots of things Mike "Rafi" wrote: How do I trap a Cancel event on the following code? I have tried the most common IF statements however, the code blows up before getting to the IF statement when CANCEL is clicked. Set rng = Application.InputBox(Msg1, Title1, Type:=8) |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
InputBox Cancel event | Excel Programming | |||
InputBox Cancel Button | Excel Programming | |||
InputBox: Separate CANCEL and 0 | Excel Programming | |||
InputBox - cancel button | Excel Programming | |||
Inputbox and cancel button | Excel Programming |