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

vba

ResolvedVersion 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:

Conditional Formatting in Excel 2010

If you have lots of data in a spreadsheet, you may find that it is easier to read if you highlight some of the values. This is Conditional Formatting and here's how to use it:

1) Select the data you wish to apply the format to and click Conditional Formatting
2) A list of options will then appear, from this list, choose the format you wish to display e.g. find all cells with a value less than 0
3) Excel will then highlight all of these cells

To remove this: select the highlighted cells, click the drop down on the Conditional Formatting icon and select Clear Rules from selected cells.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.1 secs.