Printout only visbile sheet in Array

jamesmcintyre

New Member
Joined
Nov 16, 2022
Messages
7
Office Version
  1. 365
Platform
  1. Windows
Hello, i am trying to run a macro that print an array of sheets in the description. However i have a macro that hides certain sheets pending other options and when i do the printout option it comes up with an error if one of the ****s has been hidden. The sheets need to remain hidden depending on the options.

The code i currently have is below.

Sub PrintSpecificSheets()
ThisWorkbook.Worksheets(Array("D 30%", "EW 30%", "RW 30%", "S 30%", "W 30%")).PrintOut
End Sub

Is there an option i can include that only prints the visible sheets out of whats included in the above array?
 
The code above only exports to a pdf and does not print out anything...so not sure what you mean?
 
Upvote 0

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
I mean the exported pdf when one of the sheets isnt visible includes all the sheets in the workbook. Not just the ones in the array that are visible.
 
Upvote 0
When i tested on my side I did it with all five sheets first and all five where exported, I then proceeded to hide one of the sheets and only 4 exported, I then hid another one and only 3 sheets exported ....

Are you saying that on your side if a sheet is hidden it still exports and shows in the pdf file?
 
Upvote 0
It is PDFing all sheets in the workbook not just the array even if all are visible in the array.
 
Upvote 0
Not sure why... Would suggest starting a new thread to assist with this :cool:
 
Upvote 0

Forum statistics

Threads
1,214,599
Messages
6,120,447
Members
448,966
Latest member
DannyC96

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