Simple VBA Question....?????

bfraser

Board Regular
Joined
Apr 15, 2006
Messages
113
I have three macros that I want to run right after each other.
Does anyone know how I would do this and assign them to a single toolbar icon?
 

Excel Facts

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

capparfrank

New Member
Joined
Feb 11, 2011
Messages
41
Code:
sub driver()
     Call macro1()
     Call macro2()
     Call macro3()
 
end sub


In excel 2007, you can hook driver() up to the Quick Access Toolbar under the Excel button, Excel Options, Customize.

under 'Choose commands from' combobox, pick Macros.
Add driver() (or whatever you name it)
change the icon if you want with the 'modify' button


In 2003, I can't quite remember. But I believe it's under Tools/options and there's a place you can hook up keyboard shortcuts or toolbar menu items. Sorry, i'm pretty foggy on that one these days.
 
Last edited:

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,919
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
In 2003, right click in the grey area of the toolbar and select customize.
Select Commands / Macros in the left pane.
Drag a button from the right pane to your toolbar, now right click on it to modify and assign macros.
 

bfraser

Board Regular
Joined
Apr 15, 2006
Messages
113
Thank you to both of you.

I am starting with Excel 2003, so Michael how do I assign more than one macro so module to one toolbar icon. I only seem to be able to assign one?
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
20,919
Office Version
  1. 2016
  2. 2013
  3. 2007
Platform
  1. Windows
You can only assin one macro to each custom button, so...
Once you have followed my instruction in Post #3
You have a couple of choices.
1. Add more custom buttons and assisn macros to each one
2. Assign the driver() macro, mentioned by cappafrank to the button which calls the others
3. Rather than add custom buttons, add a custom menu instead and then add the custom buttons under that new menu.
 

Forum statistics

Threads
1,141,734
Messages
5,708,166
Members
421,549
Latest member
Dtcfire

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