View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Rick Rothstein \(MVP - VB\)[_2067_] Rick Rothstein \(MVP - VB\)[_2067_] is offline
external usenet poster
 
Posts: 1
Default deleting worksheets msg box

I am very new @ coding. just started yesterday...

Out of curiosity, was it really easier to hit Shift+2 (assuming an American
keyboard) instead of simply typing "at"?<g

I have 2 problems right now...
I have several tabs, and I whant a macro to erase em all, but , Sheet(1).
(1) my macro is kinda doing it, but i dont know how to make it to loop.
(2) as the macro runs the " Worksheets(DB).Delete " line, excel pops up a
msg box confirming the lost of data on the sheet deleted, how do i work
around that?


This code should do what you ask...

Sub RemoveSheets()
Dim X As Long
Worksheets(1).Select
On Error GoTo CleanUp
Application.DisplayAlerts = False
For X = Worksheets.Count To 2 Step -1
Worksheets(X).Delete
Next
CleanUp:
Application.DisplayAlerts = True
End Sub

Rick