Print all visible sheets exept one

grady121

Active Member
Joined
May 27, 2005
Messages
383
Office Version
  1. 2016
Platform
  1. Windows
I have a workbook containing several sheets, some of which are hidden and some are not.
All I want to do is print out all of those that are visible, exept for the one named sheet (Input1)
I've managed to find a code from the Microsoft site but this only covers all the visible sheets.
Is there anyone who knows how to modify the code to exclude this one named sheet, or does it require a new code?

Code:
Sub Print_Visible_Sheets()
      Dim sht

      ' Turn off the screen redraw.
      Application.ScreenUpdating = False
      ' Loop through for all sheets in the workbook.
      For Each sht In Sheets
         ' If the current sheet is visible, then group it with the rest.
         If sht.Visible Then sht.Select Replace:=False
      Next

      ' Print all of the selected sheets.
      ActiveWindow.SelectedSheets.PrintOut copies:=1
      ' Ungroup the sheets.
      ActiveSheet.Select
      ' Turn back on the screen redraw.
      Application.ScreenUpdating = True
   End Sub

Thanks in advance.
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
Try this:

Code:
Sub print_sheets()
Dim sheet As Worksheet

For Each sheet In ActiveWorkbook.Sheets
        If sheet.Visible = True And sheet.Name <> "input1" Then
                sheet.PrintOut copies:=1
        End If
Next sheet
End Sub
 
Upvote 0
Brilliant Macropheliac - it worked just fine.
It was so good you called it twice.

Many thanks.
 
Upvote 0

Forum statistics

Threads
1,214,875
Messages
6,122,044
Members
449,063
Latest member
ak94

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top