View Single Post
  #14   Report Post  
Posted to microsoft.public.excel.misc
JMB JMB is offline
external usenet poster
 
Posts: 2,062
Default On Error Resume Next problem

although he'll probably want to suppress the "are you sure" message

application.displayalerts = false
on error resume next
worksheets("mySummary").delete
on error goto 0
application.displayalerts = true


"Dave Peterson" wrote:

One more option...

If you don't have anything against adding the sheet, maybe it's ok to just
delete it and start from scratch:

on error resume next
worksheets("mySummary").delete
on error goto 0
'then add the sheet.

Jim May wrote:

In my code after my DIM statements I have:

On Error GoTo wsAdd
With Sheets("MySummary")
.Activate
.Cells.ClearContents
End With

Let's say MySummary (sheet) does not exist - so macro jumps to:

wsAdd:
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = "MySummary"
On Error GoTo 0
Resume Next '<< Creates and Names Sheet MySummary

an returns to the line:

.Activate << Where the Macro Bombs -- What is wrong??


--

Dave Peterson