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 · Medium Priority · Version 2003

Ivan has attended:
Excel VBA Intro Intermediate course

VBA

Can a macro be written which incorporates data from a second workbook?

RE: VBA

Hi Ivan

Thank you for your question regarding Workbooks in VBA.

Yes you can access data in other workbooks in VBA, you will need to open the workbooks.

Dim mybook as Workbook
Dim myotherbook as Workbook
'
Set mybook = ActiveWorkbook
' Open other workbook
Workbooks.Open "Book2.xls"
set myotherbook = ActiveWorkbook


You can then use mybook.Activate and myotherbook.Activate to switch between the two books.

Please let me know how you get on.


Laura GB

 

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:

Transpose text

You can transpose any range of cells, turning the columns into rows and the rows into columns. Just follow these steps:

Select the range.

Click the Copy button on the Standard toolbar to copy it to the Clipboard.

Select a cell outside of the range you copied.

Select Paste Special from the Edit menu.

In the Paste Special dialog box, click Transpose, then OK.

View all Excel hints and tips


Server loaded in 0.09 secs.