LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27
Default Loops stop working and presents "1004':

Hi I have a problem with a loop that always stops after five times,
and presents "Copy method of Worksheet class failed"

The code is :

For Year = FirstYear To LastYear
Sht2 = "" & Year & " test"
Sheets(Sht2).Delete
Sht = "" & Year & " table sheet"
Sheets(Sht).Copy Befo=Sheets(2)
Sheets(Sht & " (2)").Name = Sht2

The loop fails at:

Sheets(Sht).Copy Befo=Sheets(2)


Sheet(2) is still part of the workbook while the loop breaks down.
Any suggestions as to why the loop breaks down?

Any help is greately appreciated!
 
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
How stop the "started office live" pop-up to stop. it is checked yrose24 Excel Discussion (Misc queries) 1 September 2nd 09 03:32 PM
Loops stop working and presents "Run time error '91': Wesslan Excel Programming 2 February 12th 08 11:41 AM
"Continue" and Exit with For Loops Andrew Hall NZ Excel Programming 4 November 23rd 06 02:44 AM
Stop users from accessing "Protection" option from "Tools" menu I Believe Excel Programming 2 December 19th 05 02:44 PM
"Stop" not working JMCS Excel Programming 5 October 6th 04 07:11 PM


All times are GMT +1. The time now is 03:57 AM.

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

About Us

"It's about Microsoft Excel"