View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Hutchins Tom Hutchins is offline
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