I wonder if anybody can tell me if this is possible
I have a workbook with a few blank sheets; these are used to embed pdf documents if required. However I would like to is run some code to hide the empty sheets if there has not been a pdf document embedded within that sheet.
Below code will hide empty sheets but also hide those with an embedded document which I need to avoid.
Any help is much appreciated
I have a workbook with a few blank sheets; these are used to embed pdf documents if required. However I would like to is run some code to hide the empty sheets if there has not been a pdf document embedded within that sheet.
Below code will hide empty sheets but also hide those with an embedded document which I need to avoid.
Any help is much appreciated
Code:
Sub HideBlank()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets
If (ws.name <> "PSW") And (ws.name <> "Del COC") And (ws.name <> "Del COC") And (ws.name <> "Del Note") And (ws.name <> "COC") And (ws.name <> "L1 Insp Report (1)") And _
(ws.name <> "L1 Insp Report (2)") And (ws.name <> "L1 Insp Report (3)") And (ws.name <> "L1 Insp Report (4)") And (ws.name <> "L1 Insp Report (5)") And (ws.name <> "L1 Insp Report (6)") Then
If WorksheetFunction.CountA(ws.Cells) = 0 Then
ws.Visible = xlSheetHidden
End If
End If
Next
End Sub