copying data from one worksheet to other

luisve

Board Regular
Joined
Feb 27, 2004
Messages
77
i am usig this code:

Workbooks.Open Filename:="C:\Documents and Settings\Luis\My Documents\Acs wand\Book2.xls"

yBegin = 0
If WorksheetFunction.CountA(Workbooks("book2.xls").Sheets("sheet1").Range("a:a")) > 0 Then yBegin = 1
Workbooks("book1.xls").Sheets("sheet1").Range("A2:F" & Range("A2").End(xlDown).Row).copy _
Workbooks("book2.xls").Sheets("sheet1").Range("A65536").End(xlUp).Offset(yBegin, 0)
yBegin = 0
to open a workbook and transfer all the data to a second workbook but i am getting a error that sayas cannot paste because the area of paste is diferent of the source, can help me?
 

Excel Facts

Can you sort left to right?
To sort left-to-right, use the Sort dialog box. Click Options. Choose "Sort left to right"
Your source rows is greater than your destination rows. Maybe
your distination file is already full. Why don't you create another sheet or go to another sheet . Use this statement to
determine if the data is full
on error resume next
Put your copy and paste code code here
if err.number = 1004 then
err.clear
sheets("sheet2").select
put your copy and paste code here
end if
 
Upvote 0

Forum statistics

Threads
1,214,430
Messages
6,119,453
Members
448,898
Latest member
drewmorgan128

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top