ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   select sheets for printing (https://www.excelbanter.com/excel-discussion-misc-queries/56291-select-sheets-printing.html)

bennyob

select sheets for printing
 
Can anyone tell me how to select sheets in a workbook based on a cell value
for printing?
I have many sheets, I want to select all the sheets that have a value
greater than 0 in C2 for printing, which I guess will then go something like:
ActiveWindow.SelectedSheets.PrintOut
Thanks in advance for help
Benny


Paul B

select sheets for printing
 
bennyob, try this,

Sub Print_sheets()
'will print sheet with a vavle 0 in C2
For Each Sheet In ThisWorkbook.Worksheets
Sheet.Activate
If Range("C2").Value 0 Then

'use this to test and comment out below
ActiveSheet.PrintPreview

'use this to print
'ActiveSheet.PrintOut Copies:=1, Collate:=False

End If
Next
End Sub


--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2002 & 2003

"bennyob" wrote in message
...
Can anyone tell me how to select sheets in a workbook based on a cell

value
for printing?
I have many sheets, I want to select all the sheets that have a value
greater than 0 in C2 for printing, which I guess will then go something

like:
ActiveWindow.SelectedSheets.PrintOut
Thanks in advance for help
Benny





All times are GMT +1. The time now is 04:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com