Excel VBA Course
Excel VBA Course - From Beginner to Expert

200+ Video Lessons
50+ Hours of Video
200+ Excel Guides

Become a master of VBA and Macros in Excel and learn how to automate all of your tasks in Excel with this online course. (No VBA experience required.)

View Course

Where to install a Macro

0

Hello Don

Your post titled Install a Macro into an Excel Spreadsheet points out that there are a number of places that a macro can be installed and that its important to know this before installing, but it doesn't tell us how to determine which place is best for any given situation.

Do you have some guidance for those of us that are new to macros please?

Answer
Discuss

Discussion

Please don't forget to select the answer that worked best for you! Just click the Select Answer button at the bottom of the desired answer and then click Yes to verify it.
MRVMV (rep: 52) Jul 13, '16 at 4:53 am
Add to Discussion

Answers

1
Selected Answer

I'm not Don, but I will try to help.

There are multiple places.

(events are normal macros but they are automatically fired when specific thing happen, for example workbook_open fires when you open the file).

Bold are most important causes.

  • First there are modules and you should use them when this macro will be used in more than one sheet and also modules are easy to be imported and exported.
  • You could also have macros in the sheet and you should use this when you use this macro on this sheet (you could use it outside it) and when you have events on this sheet (like worksheet_change).
  • And in "this workbook" you could have the macros that you use on multiple sheets or events on the workbook (like workbook_Open).
  • I should note also that you have a PERSONAL.XLSB file (it will be created automatically when you record macro and store it in Personal Macro Workbook) and you could use this file for storing your macros that you use on multiple Workbooks you have modules and sheets and this workbook in this file but modules are most important in this file (you could use sheets and this workbook if you want).
Discuss

Discussion

Thanks MVRMV
Is it therefore true that most of the time a module will work?
JonP (rep: 37) Jul 13, '16 at 4:40 am
That's true, except events, events couldn't be placed in modules.
MRVMV (rep: 52) Jul 13, '16 at 4:44 am
Thanks that's great 
JonP (rep: 37) Jul 13, '16 at 5:06 am
Add to Discussion


Answer the Question

You must create an account to use the forum. Create an Account or Login