View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
FSt1 FSt1 is offline
external usenet poster
 
Posts: 3,942
Default Copying worksheet error

hi,
Not sure what the problem is that cause it. it has something to do with the
clipboard.
from experience, i have learned not to use the copy command in a loop.
usually crashes the macro with memory error messages. using it once or twice
in a macro is ok but not in any kind of loop. there are other ways.
and this is not unique to xl. i had the same problem with lotus 123. and the
cut command is even worst.
try this just before the copy command........

application.cutcopymode = false

this will clear your clipboard just before the copy and may solve your
problem. post back if it doesn't.

regards
FSt1

"Newbie80" wrote:


Hi,
I have made a macro that copies worksheets from diffrent workbooks, and
then places the worksheets into the same workbook. This is a pretty
simpel function, but when I have copied to many sheets I recive an
error 1004. Is there an easi way to come around this ?

This is in a loop:
sourceWb.Worksheets("Prodject-" & year).Copy
after:=thisWb.Sheets(thisWb.Worksheets.count)


--
Newbie80
------------------------------------------------------------------------
Newbie80's Profile: http://www.excelforum.com/member.php...o&userid=25946
View this thread: http://www.excelforum.com/showthread...hreadid=394664