Why we need macro to do it? It sometimes become cumbersome to find and delete hidden tabs in a worksheet or hidden worksheets in a workbook so we are providing you straight forward method to do so.

 

Remove hidden worksheets macro : make sure that you have a backup copy of this workbook just in case.

 

Sub DeleteHiddenWorksheets()
i = 1
While i <= Worksheets.Count
If Not Worksheets(i).Visible Then
Worksheets(i).Delete
Else
i = i + 1
End If
Wend
 
End Sub

 

 

Your ads will be inserted here by

Easy Plugin for AdSense.

Please go to the plugin admin page to
Paste your ad code OR
Suppress this ad slot.

Found this one on mrexcel here this macro will delete all sheets except the one you want to keep. Here user wants to prevent “Test O2 and CO2” from being deleted.

Sub test()
Dim ws As Worksheet
Application.DisplayAlerts = False
For Each ws In ThisWorkbook.Worksheets
If ws.Visible <> True And ws.Name <> "Test O2 and CO2" Then
ws.Delete
End If
Next ws
Application.DisplayAlerts = True
End Sub

 

VIA

http://goo.gl/HZ52kR

http://goo.gl/ur0lBH


Web Directory