View Single Post
 
Old 11-24-2019, 06:28 AM
GregT GregT is offline Windows 10 Office 2016
Novice
 
Join Date: Nov 2019
Posts: 3
GregT is on a distinguished road
Default Print hidden sheets

Hi all,

I am no whiz at excel and the code here, I used from another program. Can some please add the code to this string or tell me how to do it, Please.


I have a workbook with 4 sheets - 2 are hidden. The following code I am using works with the hidden sheet.

The problem is when I protect the sheets and workbook I get an error when I try to print the protected sheet or workbook. Can you suggest a workaround? Also I would like to view before print if that is possible...

TIA GT
----------------------------------------------------------------

Sub PrintSpecificSheet()
Dim wks As Worksheet

Set wks = ActiveWorkbook.Sheets("Printout")
If wks.Visible <> xlSheetVisible Then
Application.ScreenUpdating = False
wks.Visible = xlSheetVisible
wks.PrintOut
wks.Visible = xlSheetHidden
Application.ScreenUpdating = True
Else
wks.PrintOut
End If
Set wks = Nothing
End Sub
Reply With Quote