Command Button Query

Wayne Rogers

New Member
Joined
Aug 5, 2014
Messages
17
I have around 15 different sheets in one of my spreadsheets, each running a different macro.

I want to have a main sheet with several command buttons (active x) that will run the associated macro on the relevant sheet.

i.e. the gross profit button when pressed on the main page will run the gross profit macro on the gross profit tab/sheet.

Many thanks
 

Excel Facts

What did Pito Salas invent?
Pito Salas, working for Lotus, popularized what would become to be pivot tables. It was released as Lotus Improv in 1989.
I have around 15 different sheets in one of my spreadsheets, each running a different macro.

I want to have a main sheet with several command buttons (active x) that will run the associated macro on the relevant sheet.

i.e. the gross profit button when pressed on the main page will run the gross profit macro on the gross profit tab/sheet.

Many thanks
Can be done but you need to ensure that the macro on the relevant sheet is written so that it does not require the sheet to be active to get the desired results when the macro runs. If the macros are in standard modules (not sheet event code) you can use form control command buttons and just right click the button to assign a specific macro to it.
 
Upvote 0
Hi Joe,

Thanks for your reply, Ive just put a form control button on the main page and assigned it, however it runs the macro on the main page not on the gross profit page/tab as desired.
 
Upvote 0
Hi Joe,

Thanks for your reply, Ive just put a form control button on the main page and assigned it, however it runs the macro on the main page not on the gross profit page/tab as desired.
That's what I tried to point out in my reply (Post #2). You either have to re-write the macro or start it with:

Application.screenupdating = false
Sheets("The Sheet Name of the sheet to run the macro on here").Select

and end it with:
Sheets("The main sheet name here").select
Application.screenupdating = true
 
Upvote 0
Hi Joe,

Works a treat, thank you very much for your help with this.

I'm new to using macros and vba and I'm currently looking for a good source of training to help me gain some basic knowledge.

Once again thank you.

Wayne
 
Upvote 0
Hi Joe,

Works a treat, thank you very much for your help with this.

I'm new to using macros and vba and I'm currently looking for a good source of training to help me gain some basic knowledge.

Once again thank you.

Wayne
You are welcome - thanks for the reply.
 
Upvote 0

Forum statistics

Threads
1,223,908
Messages
6,175,307
Members
452,633
Latest member
DougMo

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
Back
Top