Run Macro A if Cell A1 is equal to A...

rage300

New Member
Joined
Feb 25, 2005
Messages
12
I have a series of 4 macros that I need to run depending on which week of the month it is. I would like to automate this process by entering in the week number in Cell A1 and clicking a button that says "go". Can I set up a macro to run other macros depending on this value?

Thanks,

Jason
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

Jonmo1

MrExcel MVP
Joined
Oct 12, 2006
Messages
44,061
Code:
sub checkmonth()
If Range("A1").Value = 1 then application.run "macro1name"
If Range("A1").Value = 2 then application.run "macro2name"
If Range("A1").Value = 3 then application.run "macro3name"
etc...
 

VoG

Legend
Joined
Jun 19, 2002
Messages
63,650
Right click the sheet tab and select View Code. Copy and paste in

Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count > 1 Or Target.Address(False, False) <> "A1" Then Exit Sub
Select Case Target.Value
    Case 1:
        Call macroA
    Case 2:
        Call macroB
End Select
End Sub

Adjust to the values you expect in A1 and the macro names, then close the code window and test by changing the value in A1.
 

rage300

New Member
Joined
Feb 25, 2005
Messages
12
You're a rockstar man. That was the easiest thing I did all day. And thanks for such a quick response.


Have a great day.
 

Forum statistics

Threads
1,181,724
Messages
5,931,688
Members
436,798
Latest member
spprtpplcm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top