ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying a sheet fails (https://www.excelbanter.com/excel-programming/442641-copying-sheet-fails.html)

Michelle

Copying a sheet fails
 
I have a line that copies a sheet from one book to another. It works a
number of times in my macro then inexplicably stops working.

The line is:
ActiveSheet.Copy Befo=Workbooks(NewBookName).Sheets("XXX")

And I get the error: 1004
"Copy method of worksheet class failed"

It stops when I try to add the 54th sheet in a workbook - I don't know if
that number is significant.

There is no problem with the string: 'NewBookName' or the sheet named 'XXX'
(as I say the line works 52 times)

But suddenly I get an error

Anyone seen this before?

Thanks

M


JLGWhiz[_2_]

Copying a sheet fails
 
There have been several similar postings about this condition. In most
cases, I believe the resolution was to make a loop where after so many
copies it would break and then resume. But I don't relly remember all the
details.


"Michelle" wrote in message
...
I have a line that copies a sheet from one book to another. It works a
number of times in my macro then inexplicably stops working.

The line is:
ActiveSheet.Copy Befo=Workbooks(NewBookName).Sheets("XXX")

And I get the error: 1004
"Copy method of worksheet class failed"

It stops when I try to add the 54th sheet in a workbook - I don't know if
that number is significant.

There is no problem with the string: 'NewBookName' or the sheet named
'XXX' (as I say the line works 52 times)

But suddenly I get an error

Anyone seen this before?

Thanks

M




Ron de Bruin

Copying a sheet fails
 
See
http://support.microsoft.com/kb/210684/en-us

--

Regards Ron de Bruin
http://www.rondebruin.nl/tips.htm



"JLGWhiz" wrote in message ...
There have been several similar postings about this condition. In most
cases, I believe the resolution was to make a loop where after so many
copies it would break and then resume. But I don't relly remember all the
details.


"Michelle" wrote in message
...
I have a line that copies a sheet from one book to another. It works a
number of times in my macro then inexplicably stops working.

The line is:
ActiveSheet.Copy Befo=Workbooks(NewBookName).Sheets("XXX")

And I get the error: 1004
"Copy method of worksheet class failed"

It stops when I try to add the 54th sheet in a workbook - I don't know if
that number is significant.

There is no problem with the string: 'NewBookName' or the sheet named
'XXX' (as I say the line works 52 times)

But suddenly I get an error

Anyone seen this before?

Thanks

M





All times are GMT +1. The time now is 01:52 AM.

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