Macro to delete sheets listed in column A of sheet 1

shammie4

New Member
Joined
Nov 15, 2006
Messages
17
Hi all,
I made a terrible mistake and created a bunch of sheets in an excel file. There are about 350 sheets in all. I need to remove about 55. I have a list of the sheets to be removed in column A.
Does anyone know a macro that can delete those sheets?

Thanks!
 

Excel Facts

When they said...
When they said you are going to "Excel at life", they meant you "will be doing Excel your whole life".
If your list of sheets to delete is on Sheet1 column A, try

Code:
Sub DeleteSheets()
Dim lr As Long, i As Long
Application.DisplayAlerts = False
With Sheets("Sheet1")
    lr = .Cells(Rows.Count, "A").End(xlup).Row
    For i = 1 to lr
        Sheets(.Cells(i, "A").Value).Delete
    Next i
End With
Application.DisplayAlerts = True
End Sub
 
Upvote 0
Wow Thanks. All those sheets that I created in error are gone!IT was such a pain deleting them one by one.
You rock!
 
Upvote 0

Forum statistics

Threads
1,214,983
Messages
6,122,598
Members
449,089
Latest member
Motoracer88

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