![]() |
![]() |
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
I have this code.
Dim ws As Worksheet For Each ws In Sheets If ws.Name = "Test" Then ws.Select Application.DisplayAlerts = False Message = MsgBox("Delete " & ws.Name & " sheet?", vbYesNo, "ARE YOU SURE ABOUT THIS?") 'Does not require End If statement If Message = vbYes Then Worksheets(ws.Name).Delete End If Next ws - more code- End Sub How do I get it to exit the macro if the use chooses NO instead of YES? |
|
|
|
|
|
#2 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Columbus, OH, USA
Posts: 3,519
|
|
|
|
|
|
|
#3 |
|
Board Regular
Join Date: Feb 2002
Location: Tulsa, OK
Posts: 354
|
I am afriad I don't know what you mean by additional sub-routines!
Please excuse my ignorance! |
|
|
|
|
|
#4 |
|
MrExcel MVP
Join Date: Feb 2002
Location: Christchurch New Zealand
Posts: 1,030
|
or
if message = vbno then exit sub |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|