ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Delete hidden worksheets (https://www.excelbanter.com/excel-programming/291455-delete-hidden-worksheets.html)

Shamsul Islam

Delete hidden worksheets
 
Hi

What code can be used to delete all hidden worksheets?

Thanks

Sham

Frank Kabel

Delete hidden worksheets
 
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)


--
Regards
Frank Kabel
Frankfurt, Germany

Shamsul Islam wrote:
Hi

What code can be used to delete all hidden worksheets?

Thanks

Sham



Bob Phillips[_6_]

Delete hidden worksheets
 
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)

"Shamsul Islam" wrote in message
...
Hi

What code can be used to delete all hidden worksheets?

Thanks

Sham





All times are GMT +1. The time now is 06:53 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com