ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   New Users to Excel (https://www.excelbanter.com/new-users-excel/)
-   -   How to end my macro in If-else-Endif (https://www.excelbanter.com/new-users-excel/138086-how-end-my-macro-if-else-endif.html)

tan

How to end my macro in If-else-Endif
 
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


Gary''s Student

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



All times are GMT +1. The time now is 01:21 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com