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: 36
Default Need Help Troubleshooting

The code below is designed to copy the activesheet, clear the
contents, and place it at the front of the workbook. It works well,
but if I initiate the code a number of times without closing the
workbook I get an error:

Run-Time Error '1004'
Copy method of worksheet class failed.

Can any one figure out how to fix this problem, or explain why it
happens? Also if anyone has any suggestions for how to make my code
more efficient please let me know. Thank you.

John

Sub NewReport()
ActiveSheet.Copy Befo=Sheets(1)
ActiveSheet.Unprotect
Application.ScreenUpdating = False
Range("F3,G6,G8,B17:K31,U17:AD31,AE17:AX31,_
B35:AB54,AE34:BG54,B58:BG72,B88:BG149,I162:AD203,_
AK162:BE185,AK188:BD203,H205,C206:BF211").Select
Selection.ClearContents
Range("BK17:BK31").Value = 7

If Sheets(1).Range("AZ3").Value < "" And
IsNumeric(Sheets(1).Range("AZ3").Value) = True Then
ActiveSheet.Range("AZ3").Value = Sheets(2).Range("AZ3").Value
+ 1
Else
ActiveSheet.Range("AZ3").Value = Application.Sheets.Count - 1
End If

If Sheets(2).Range("AX6").Value < "" Then
ActiveSheet.Range("AX6").Value = Sheets(2).Range("AX6").Value
+ 1
Else
ActiveSheet.Range("AX6").Value = Date
End If

Rows("77:290").Select
Selection.EntireRow.Hidden = True
ActiveSheet.Shapes("Text Box 9").Visible = False
ActiveSheet.Shapes("Button 5").Select
Selection.Characters.Text = "Add Gridpaper"
ActiveSheet.Shapes("Button 6").Select
Selection.Characters.Text = "Add Time Log"
ActiveSheet.Shapes("Button 8").Select
Selection.Characters.Text = "Add Narrative"
Range("BK34:BK42").Value = 0

Range("B17").Select
ActiveSheet.Protect
Application.ScreenUpdating = True
End Sub

 
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
Troubleshooting David Rogers Excel Discussion (Misc queries) 2 November 26th 08 12:02 PM
Function Troubleshooting Sarah Excel Worksheet Functions 1 June 7th 07 10:28 PM
Troubleshooting Spreadsheets valkyrie Excel Discussion (Misc queries) 1 August 1st 06 04:24 AM
troubleshooting Mr. Lucky69 Setting up and Configuration of Excel 0 April 29th 06 08:57 PM
DDE Troubleshooting Opterabot22 Excel Programming 2 May 13th 04 11:30 PM


All times are GMT +1. The time now is 10:01 PM.

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"