ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copy method of worksheet class failed - loop copying worksheets (https://www.excelbanter.com/excel-programming/368914-copy-method-worksheet-class-failed-loop-copying-worksheets.html)

lif[_12_]

Copy method of worksheet class failed - loop copying worksheets
 

Hi again,

Here's another one I found documentation for online but still can'
manage to fix.

I am using a certain sheet as a template that gets copied and rename
many times. After a while I get the following error

Run-Time error '1004' : Copy method of worksheet class failed

I read that this is related to an excel limitation/bug that causes thi
and found some microsoft articles explaining that the file must b
opened and closed as a workaround.

What's the best way to workaround this bug? At most I will need to d
like 25 worksheet copies in a session -

This is the code that causes the problem.
Worksheets(template(I)).Select
Worksheets(template(I)).Cop
after:=Worksheets(Application.Sheets.Count)


Thanks so much for any help - My head is hurting from trying to fi
this.

Lui

--
li
-----------------------------------------------------------------------
lif's Profile: http://www.excelforum.com/member.php...fo&userid=3574
View this thread: http://www.excelforum.com/showthread.php?threadid=56682



All times are GMT +1. The time now is 02:14 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com