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

Ivan has attended:
Excel VBA Intro Intermediate course

VBA

How do you copy data from one workbook and paste into a different workbook using macro?

RE: VBA

Hi Ivan

The way to copy data between 2 workbooks is to have both workbooks open at the time.

So from Workbook1 you need to open Workbook2. To do this:

ChDir "C:\"
Workbooks.Open Filename:="C:\My Doduments\Workbook2.xls

You then indicate which data is to be copied and where it is to be pasted.

When the copy and paste has been done you close Workbook 2 as follows:
.
Windows("Workbook2.xls").Activate
ActiveWorkbook.Save
ActiveWorkbook.Close

Hope this helps

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:

Change the Value of a Constant

When using a named constant in a worksheet, you may wish to change the value of that constant.

From the 'Insert' menu, select 'Name', then select 'Define'.

In the 'Define Name' dialog box, select the constant that you want to change.
Change the value in the 'Refers To' box.
Click OK.

Wherever that named constant has been used it will now use its new value.

View all Excel hints and tips


Server loaded in 0.08 secs.