A Microsoft Excel forum. ExcelBanter

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » ExcelBanter forum » Excel Newsgroups » New Users to Excel
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

How to end my macro in If-else-Endif



 
 
Thread Tools Display Modes
  #1  
Old April 6th 07, 10:34 AM posted to microsoft.public.excel.newusers
tan
external usenet poster
 
Posts: 29
Default 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

Ads
  #2  
Old April 6th 07, 10:48 AM posted to microsoft.public.excel.newusers
Gary''s Student
external usenet poster
 
Posts: 11,059
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
>

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 1 February 5th 07 10:31 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 09:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 1 June 11th 05 12:44 AM
Macro needed to Paste Values and prevent Macro operation thunderfoot Excel Discussion (Misc queries) 0 June 10th 05 03:38 PM


All times are GMT +1. The time now is 11:20 AM.


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