macro to call other macros

C

Colin Hayes

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.
 
J

joeu2004

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top