vba

Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA

VBA

resolvedResolved · Low Priority · Version 2003

Elaine has attended:
Excel VBA Intro Intermediate course

VBA

When creating code in one workbook how do you make it available to other workbooks?

Make Code Available

Hi Elaine

If code is written in the Personal Macro Workbook it can be used by all workbooks that are opened on your computer.

Also, if Procedures(Macros) created in any workbook are preceded by the word Public (eg Public Sub MyMacro() ) then they will be visible by all open workbooks.

The danger of writing code in one workbook (Book A) to be used in another workbook (Book B), is that Book A has to be open on the computer for Book B to be able to use the code.

This means that if Book B is sent to someone else they can't run any of the code.

As a good practice I always advise people to copy the code into all the workbooks that will be using it.

It may be duplication of code but will save hours of frustration in the long term.

Regards

Carlos

 

Training courses

 

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.


 

Excel tip:

Moving between Worksheets without using the mouse

Use the 'Ctrl+PgDn' and 'Ctrl+PgUp' keys.

'Ctrl+PgDn' will move to the right and 'Ctrl+PgUp' will move to the left one worksheet at a time.

View all Excel hints and tips


Server loaded in 0.08 secs.