macros

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

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

Macros

resolvedResolved · Low Priority · Version 2003

Linda has attended:
Excel Advanced course
Excel VBA Intro Intermediate course

Macros

How would I go about recording a macro involving multiple workbooks, can I use recorder?

Recording the opening of a workbook

Hi Linda

The simple answer is YES, you can use the macro recorder to record the code involving multiple workbooks. The example I give below was recorded by me and from an open workbook it opens another workbook, brings some data across and then closes the workbook.

Sub Test

Workbooks.Open Filename:="C:My Documents\Accounts 2007.xls"

Windows("Accounts 2008.xls").Activate
Range("J7").Select
ActiveCell.FormulaR1C1 = "='[Accounts 2007.xls]Sheet1'!R9C4"
Windows("Accounts 2007.xls").Close

End Sub

You can then edit the code for better use; like stopping the screen updating so the user doesn't see the other workbook being accessed.

Hope this helped

Carlos

 

Training courses

 

Training information:

See also:

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:

Some examples of CTRL key shortcuts in Excel 2010

Did you know that the old CTRL key shortcuts haven't changed from previous versions of Excel to the 2010 version?

They remain exactly the same:

Ctrl+B for bold
Ctrl+I for italics
Ctrl+P to Print
Ctrl+S to Save

View all Excel hints and tips


Server loaded in 0.08 secs.