Deleting sheets

  • Thread starter Thread starter oldjay
  • Start date Start date
O

oldjay

I want a command button that deletes all sheets except the one named Master
 
Try the below

Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Sheets
If ws.Name <> "Master" Then ws.Delete
Next
Application.DisplayAlerts = True
 
Thanks

Jacob Skaria said:
Try the below

Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In Sheets
If ws.Name <> "Master" Then ws.Delete
Next
Application.DisplayAlerts = True
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top