LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,069
Default Userform cancel problem

If the length of the return value from the inputbox is zero, nothing was
entered or Cancel was clicked:

Sub AAAAAA()
Dim retval
retval = InputBox("Enter something", "My title", "XYZ")
If Len(retval) = 0 Then Exit Sub
MsgBox "Didn't cancel; entered something"
End Sub

Hope this helps,

Hutch

"DDawson" wrote:

I have a button on the workbook that calls up a macro that in turn displays
an inputbox type userform. I can't get the cancel button to cancel out of the
macro, i.e. the macro still runs.

How do I stop the macro from running when I click cancel?

Dylan



 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Cancel Out of UserForm Return Focus Minitman Excel Programming 10 October 1st 08 05:44 AM
Userform Cancel Hank Youngerman Excel Programming 3 November 17th 06 07:14 PM
userform cancel button davegb Excel Programming 3 June 12th 06 05:23 PM
Cancel a Procedure through a Userform jumpjump[_3_] Excel Programming 1 August 30th 05 09:52 AM
Cancel Button on Userform KJ Dahl Excel Programming 2 December 19th 04 07:47 PM


All times are GMT +1. The time now is 05:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"