deleting all but sheet(1) w/ macro

pjordan

New Member
Joined
Sep 17, 2002
Messages
1
I have a main summery page that creates subsequent pages full of data. First, however, I need to delete all the other pages, as these will contain old data. I am using the following code:

On Error Resume Next
Err.Clear
Do
Sheets(2).Delete
Loop While Err.Number = 0

This works, but requires me to tell excel is OK to delete each page, which gets tiresome after ~20 pages. :smile:

Is there a way to disable this warning?
Else, can I select all sheets but sheet(1) and delete them in one fell swoop?

Thanks
-pj
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.

Forum statistics

Threads
1,222,398
Messages
6,165,770
Members
451,986
Latest member
samwize

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top