Copy - pasting macro

pincivma

Board Regular
Joined
Dec 12, 2004
Messages
172
Hi there
I have 2 workbooks opened at the same time. Lets call them workbook1 and worbook2.
I have workbook1 opened and I recorded a macro. In workbook1 I copy the range A2:H158 into workbook2
Here is a partial recorded code


Range("A2:H158").Select
Selection.Copy
Windows("workbook2.xlsx").Activate
Sheets("Sheet1").Select
Range("A2").Select
ActiveSheet.Paste

Here is what happened. Workbook2 did not open up when I ran the macro even though it opened up when I recorded the macro. Is there a different code I can use instead of Windows("workbook2.xlsx").Activate?

Thanks in advance.
 

Forum statistics

Threads
1,078,134
Messages
5,338,428
Members
399,232
Latest member
stevenmoritz

Some videos you may like

This Week's Hot Topics

Top