![]() |
InputBox Cancel event
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) |
InputBox Cancel event
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) |
InputBox Cancel event
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) |
All times are GMT +1. The time now is 12:34 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com