Is it possible to run a different VBA procedure to different worksheets on a shortcut key

edlim85

Board Regular
Joined
May 4, 2009
Messages
178
Hihi,

I am new and just started on excel VBA.

Say i have many worksheets in say book1.xlsm and each worksheet have its own set of unique vba procedures. Can I run everything at once ie with a short cut key?

if yes, I will need some guide to go about doing it
-Do I write my codes in each worksheet?
-or put all my codes in a module and use "if then statement" to find the worksheet to run a particular procedure to that worksheet

Pls advise.

Regards
Edmund
 

Excel Facts

Shade all formula cells
To shade all formula cells: Home, Find & Select, Formulas to select all formulas. Then apply a light fill color.
Hihi,

I am new and just started on excel VBA.

Say i have many worksheets in say book1.xlsm and each worksheet have its own set of unique vba procedures. Can I run everything at once ie with a short cut key?

if yes, I will need some guide to go about doing it
-Do I write my codes in each worksheet?
-or put all my codes in a module and use "if then statement" to find the worksheet to run a particular procedure to that worksheet

Pls advise.

Regards
Edmund


Hi,
if the macro (code) is the same for each sheet then one macro is needed on the whole workbook. in saying that shortcut yes. go to View then click macros/view macros. highlight the one you want and goto options. on the little screen there s shortcut which is Ctrl + something you want.

press ok
 
Upvote 0
You can do run different code but one at a time..let say

In one marco..
Code:
Sub RunAll()
Call Macro1
Call Macro2
Call Macro3
...so on
End Sub
 
Upvote 0
Sub RunAll()Call Macro1Call Macro2Call Macro3...so onEnd Sub</PRE>
Each macro is different, in other words unique to a specific worksheet. i'll try using the call function above.

cheers and thanks guys.
 
Upvote 0

Forum statistics

Threads
1,224,524
Messages
6,179,308
Members
452,904
Latest member
CodeMasterX

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