#1   Report Post  
Posted to microsoft.public.excel.misc
vishu
 
Posts: n/a
Default Swithces in Macro

Hi,
I have 3 macros to run.
When user run first macro, it will ask for Yes or No option.
If user select €œyes€ automatically 2 macro should run, If user selects €œNo€
3 macro should run.
Can you please tell me how to write switches between these three macro?

Regards,
Vishu

  #2   Report Post  
Posted to microsoft.public.excel.misc
Bob Phillips
 
Posts: n/a
Default Swithces in Macro

Write them as functions and return the result. As an example

Sub Macro1()
Dim ans
ans = MsgBox("Macro1", vbYesNo)
If ans = vbYes Then
If Func2 = vbYes Then
Func3
End If
End If
End Sub

Function Func2()
Dim ans
ans = MsgBox("Func2", vbYesNo)
Func2 = ans
End Function

Function Func3()
Dim ans
ans = MsgBox("Func3", vbYesNo)
Func3 = ans
End Function

--

HTH

RP
(remove nothere from the email address if mailing direct)


"vishu" wrote in message
...
Hi,
I have 3 macros to run.
When user run first macro, it will ask for Yes or No option.
If user select "yes" automatically 2 macro should run, If user selects

"No"
3 macro should run.
Can you please tell me how to write switches between these three macro?

Regards,
Vishu



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
Editing a simple macro Connie Martin Excel Worksheet Functions 5 November 29th 05 09:19 PM
Can T Get Macro To Run! Nipper New Users to Excel 2 November 4th 05 04:48 AM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
Help with macro looping and color query function kevinm Excel Discussion (Misc queries) 10 May 26th 05 01:25 AM
Date macro Hiking Excel Discussion (Misc queries) 9 February 3rd 05 12:40 AM


All times are GMT +1. The time now is 01:39 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"