Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Copy Method Failing.

Hello I have a script that loops through copying sheets as below, it
imports 7 sheets then goes through this loop:

Worksheets(7).Select
Worksheets(7).Copy After:=Sheets(7)
Worksheets(8).Name = szUserid

This basically loops through and creates identical sheets that are then
populated with data. All in all it creates about 40-50 sheets. All with
different names.

Te first time I run it it works fine. Then after that it comes up with
a error:

Runtime Error 1004
Copy Method of Worksheet Clase Failed.

I have restarted Excel and it still wont run, then restarted the PC and
it still wont run. I then close excel wait a while and try it again and
it runs. Nothing has changed. Very weird. The files I am asking it to
create exist and the method works most of the time so is it a memory
problem, but restarting the PC should solve this.

Any ideas gratefully received.

Thanks John

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 318
Default Excel Copy Method Failing.

Hi John,

I found these useful links while searching your problem on Google


http://support.microsoft.com/?Â*kbid=210684
Xl2000: Copying Worksheet Programmatically Causes Run-Time Error 1004
http://support.microsoft.com/?Â*kbid=177634
Xl97: Copy Method Of Sheets Object Causes Invalid Page Fault

See if they help.

Alok Joshi

" wrote:

Hello I have a script that loops through copying sheets as below, it
imports 7 sheets then goes through this loop:

Worksheets(7).Select
Worksheets(7).Copy After:=Sheets(7)
Worksheets(8).Name = szUserid

This basically loops through and creates identical sheets that are then
populated with data. All in all it creates about 40-50 sheets. All with
different names.

Te first time I run it it works fine. Then after that it comes up with
a error:

Runtime Error 1004
Copy Method of Worksheet Clase Failed.

I have restarted Excel and it still wont run, then restarted the PC and
it still wont run. I then close excel wait a while and try it again and
it runs. Nothing has changed. Very weird. The files I am asking it to
create exist and the method works most of the time so is it a memory
problem, but restarting the PC should solve this.

Any ideas gratefully received.

Thanks John


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4
Default Excel Copy Method Failing.

This worked a treat thanks. How come I never find anything on the
microsoft website. Thanks for this the first one was the problem.

Cheers John

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Keyboards Shortcuts in Excel 2002 Failing to Work Tapioca Excel Discussion (Misc queries) 4 September 4th 07 03:32 AM
Excel Macro Security Failing JayCl Excel Discussion (Misc queries) 0 September 28th 06 04:11 PM
select method of range class failing ? mark kubicki Excel Programming 6 April 21st 05 05:38 PM
add method of validation failing mark kubicki Excel Programming 2 April 19th 05 08:08 PM
Copy Method Rowan[_2_] Excel Programming 4 April 15th 05 08:48 AM


All times are GMT +1. The time now is 07:32 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"