Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can't get Cancel to work in message box
I having problems with getting the cancel to cancel or close the massage box
at any time the macro is running. Help ----------------------------------------------------------------------------------------------- Sub HideYesNo() Dim iYesNo As Integer Dim wb As Workbook Dim ws As Worksheet Set wb = ActiveWorkbook For Each ws In wb.Worksheets If Sheets(ws.Name).Visible Then iYesNo = MsgBox("Hide Sheet " & ws.Name & _ " ?", vbQuestion + vbYesNoCancel, _ "Hide This Sheet") If iYesNo = vbCancel Then Cancel = True If iYesNo = vbYes Then Sheets(ws.Name).Visible = False End If End If End If Next ws Set wb = Nothing Set ws = Nothing ------------------------------------------------------------------------------------------------ |
#2
Posted to microsoft.public.excel.misc
|
|||
|
|||
Can't get Cancel to work in message box
You could change the line that currently says
Cancel = True to this: End ....which will stop the macro. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Removing Rows for Printing | Excel Worksheet Functions | |||
Message Input with link to different work sheet | New Users to Excel | |||
Message Input with link to different work sheet | New Users to Excel | |||
Password redundant through use of cancel | Excel Discussion (Misc queries) | |||
message box without ok or cancel button | Excel Discussion (Misc queries) |