Results 1 to 3 of 3

Thread: Print button macro

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Seeker GregT's Avatar
    Join Date
    Nov 2019
    Excel Version

    Print button macro

    Hi all,

    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.Visible = xlSheetHidden
    Application.ScreenUpdating = True
    End If
    Set wks = Nothing
    End Sub
    Last edited by GregT; 2019-11-16 at 02:12 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts