Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
* Kenneth *
 
Posts: n/a
Default 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   Report Post  
Posted to microsoft.public.excel.misc
Dave O
 
Posts: n/a
Default 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
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
Removing Rows for Printing Frick Excel Worksheet Functions 20 March 10th 06 10:53 PM
Message Input with link to different work sheet KPM New Users to Excel 0 February 4th 06 05:20 PM
Message Input with link to different work sheet paul New Users to Excel 0 February 4th 06 02:59 PM
Password redundant through use of cancel Blokeyfella Excel Discussion (Misc queries) 1 February 1st 06 05:00 PM
message box without ok or cancel button Subash Excel Discussion (Misc queries) 1 October 18th 05 10:38 AM


All times are GMT +1. The time now is 04:48 PM.

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

About Us

"It's about Microsoft Excel"