View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.newusers
Gary''s Student Gary''s Student is offline
external usenet poster
 
Posts: 11,058
Default How to end my macro in If-else-Endif

If Response = vbYes Then ' User chose Yes.
Call Unhide_xlVeryHidden_All_Sheets

Sheets("Login").Select
Sheets("Login").Range("S1") = ""
ActiveWorkbook.Save

ActiveSheet.Move After:=Sheets(Sheets.Count)
For Each oSheet In Sheets
oSheet.Visible = xlVeryHidden
Next

Else ' User chose No.
Exit Sub
End If

--
Gary''s Student - gsnu200713


"Tan" wrote:

Hi All,

I have wrote a msgbox with vbYesNo. But encounter the problem of how to exit
this macro if end user click No on my msgbox. Please advice me on what should
i substitute 'DoNothing' in my macro below. Thanks.

If Response = vbYes Then ' User chose Yes.
Call Unhide_xlVeryHidden_All_Sheets

Sheets("Login").Select
Sheets("Login").Range("S1") = ""
ActiveWorkbook.Save

ActiveSheet.Move After:=Sheets(Sheets.Count)
For Each oSheet In Sheets
oSheet.Visible = xlVeryHidden
Next

Else ' User chose No.
DONOTHING <----------------------------
End If

 
ExcelBanter Database Error
Database Error Database error
The ExcelBanter database has encountered a problem.

Please try the following:
  • Load the page again by clicking the Refresh button in your web browser.
  • Open the www.excelbanter.com home page, then try to open another page.
  • Click the Back button to try another link.
The www.excelbanter.com forum technical staff have been notified of the error, though you may contact them if the problem persists.
 
We apologise for any inconvenience.