Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

HELP ME PLEASE!

Status
Not open for further replies.

jessedh

MIS
Apr 16, 2002
96
US
I have a workbook that all of a sudden stopped letting me copy sheets. It allows it every once in a while, but then it also completely crashes too. I have no clue how or why this happened.

This is the code that started all of the problems...

Any ideas or suggestions?

Sheets(Array("LO", "YTD 2003")).Select
Sheets("LO").Activate
Sheets(Array("LO", "YTD 2003")).Copy Before:=Sheets(3)
Sheets("LO (2)").Select

SheetName = UCase(InputBox("Enter Name"))
Sheets("LO (2)").name = SheetName & " CURRENT"
Sheets("YTD 2003 (2)").name = SheetName & " YTD"
 
Have a look in the VBE in the "Project" window
I'm betting you have a sheet CODE name like
Sheet12111111111111111111
somewhere - there is a limit to the no. of characters allowed in a sheet code name and in xl97 (not sure about XP / 2000) every time you COPY a sheet, it creates a new sheet with a 1 added to the name hence
sheet12 becomes sheet121 and next time sheet1211 etc etc
Just rename the codename of the sheet (in the properties window and you should be alright again (for a bit)

Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
good thought, but that didn't do it.

Found that we lost power while the file was open and I feel as if it might have been damaged.
 
Could well be. Can I make a suggestion please. There a re lots of people who use the archives to search for answers to their questions and thread titles like "HELP ME PLEASE" will obviously not show up in most searches. In the future, could you please use more meaningful titles for your threads


Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
I've had problems with Excel when attempting to run sheet copy macros when the Excel file is NOT on a local drive, i.e. it's on a server somewhere.

If the file isn't local, make a copy of it on your computer and run it and see if you get the same problems.

If you don't, I can't help you. If you do, indeed the problem is with the file itself.

Onwards,

Q-
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top