ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   macro to call other macros (https://www.excelbanter.com/excel-worksheet-functions/270787-macro-call-other-macros.html)

Colin Hayes

macro to call other macros
 


Hi all

I need help to construct small routine which will call a choice of
macros.

I have in mind that if the user answers Yes to a popup then one named
macro would be run on the open workbook , and if No were chosen then a
different named macro would be run on the open workbook.

Can some one help with this?

Grateful for any advice.


joeu2004

macro to call other macros
 
On May 3, 7:44*am, Colin Hayes wrote:
I need help to construct small routine which will call
a choice of macros.
I have in mind that if the user answers Yes to a popup
then one named macro would be run on the open workbook,
and if No were chosen then a different named macro would
be run on the open workbook.


What you ask for can be done with MsgBox. See the example below.
More generally, you might want to look the help page for InputBox.

Macros....

Sub doit()
Dim x As Long
x = MsgBox("Are you over 55?", vbYesNoCancel, "Your title")
If x = vbYes Then doit2 x _
Else If x = vbNo Then doit3 x
End Sub

Sub doit2(x As Long)
MsgBox "doit2 " & x
End Sub

Sub doit3(x As Long)
MsgBox "doit3 " & x
End Sub


All times are GMT +1. The time now is 05:26 AM.

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