98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel Training and help » Macros
Macros
Resolved · 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 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
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Some examples of CTRL key shortcuts in Excel 2010Did you know that the old CTRL key shortcuts haven't changed from previous versions of Excel to the 2010 version? |