Copy and Paste problem

  • Thread starter Thread starter Piotr
  • Start date Start date
P

Piotr

Hi,
I have made macros to copy sheet form one file and paste into another,
however somtimes there is a problem when for example I change print area
in target file or anything else I recive a message:
Error the target area is not the same size as the copy area what is
starnge as area doesnt change, only solution i found is simply delete
the file and make a new one.
Im sure you have same problem but did you find a solution ?
 
Piotr,

I'm not sure what the Print Area has to do with copying and pasting. Have
you determined for sure which statement in your code is generating the
error? Perhaps if you post the code of the macro, and any other relevant
information about the sheets.

Generally, in a macro, you copy/paste like this:

1) This method doesn't use the clipboard.
Workbooks(Source).Sheets(Whatever).Range(Whatever).Copy Destination:=
Workbooks(Destination).Sheets(Whatever).Range(Whatever)

2) This method does use the clipboard.
Workbooks(Source).Sheets(Whatever).Range(Whatever).Copy
Workbooks(Destination).Sheets(Whatever).Range(Whatever).Paste

In either case, it will start the paste in the upper-left cell of the
destination range, ignoring the actual extents of that range; it pastes the
entire range from the Copy. You need only specify the upper left cell.
 
Back
Top