January 27, 2020

Print Only Hidden Worksheets Automatically

How to print only hidden worksheets in an Excel workbook automatically with VBA.
Here’s the complete VBA code:

Sub PrintHiddenSheets()
Dim wksht As Worksheet
Application.ScreenUpdating = False
For Each wksht In ActiveWorkbook.Worksheets
If Not wksht.Visible Then
wksht.Visible = True
wksht.Visible = False
End If

Application.ScreenUpdating = False

End Sub