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

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.

Chitosunday

Well-known Member
Joined
Jul 14, 2003
Messages
1,017
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
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,151,882
Messages
5,766,896
Members
425,383
Latest member
IllDo

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
Top