Delete hidden worksheets

  • Thread starter Thread starter Shamsul Islam
  • Start date Start date
Hi
try
Sub delete_hidden()
Dim wkSht As Worksheet
For Each wkSht In ActiveWorkbook.Worksheets
If wkSht.Visible <> True Then
wkSht.Delete
End If
Next wkSht
End Sub

this will delete all sheets that are not visible (xlSheetHidden and
xlSheetVeryHidden)
 
Sub DeleteHidden()
Dim sh As Worksheet
Application.DisplayAlerts = False
For Each sh In ActiveWorkbook.Worksheets
If sh.Visible = xlHidden Or sh.Visible = xlVeryHidden Then
sh.Delete
End If
Next sh
Application.DisplayAlerts = True
End Sub

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Back
Top