ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible? (https://www.excelbanter.com/excel-programming/379146-print-sheets-all-sheets-workbook-except-specific-named-sheets-possible.html)

Corey

Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible?
 
I have several worksheets that i need to print off.
But since i can add more sheets to this workbook,
i want to be able to print off all the sheets (not by name) except for about
3 sheets i can name.

Currently i have a macro that specifies each sheet by name then prints 1
page from it.
But as i have now added a couple of sheets to it, i need to keep adding more
code to it to include the newly added sheets.

My thinking is if i can have a code that will print all sheets a specified
page(1) except for,
say sheet1, sheet2 and sheet3.

Is this possible?

Corey....



Tom Ogilvy

Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible?
 
Dim sh as Worksheet
for each sh in Thisworkbook.Worksheets
if sh.Name < "Sheet1" and sh.name _
< "Sheet2" and sh.Name < "Sheet3" then

' do something with Sh

end if
Next

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...
I have several worksheets that i need to print off.
But since i can add more sheets to this workbook,
i want to be able to print off all the sheets (not by name) except for
about 3 sheets i can name.

Currently i have a macro that specifies each sheet by name then prints 1
page from it.
But as i have now added a couple of sheets to it, i need to keep adding
more code to it to include the newly added sheets.

My thinking is if i can have a code that will print all sheets a specified
page(1) except for,
say sheet1, sheet2 and sheet3.

Is this possible?

Corey....




Corey

Print sheets by "All Sheets in workbook, EXCEPT for specific named sheets". Possible?
 
Thanks Tom.
Too easy.

Cheers.
"Tom Ogilvy" wrote in message
...
Dim sh as Worksheet
for each sh in Thisworkbook.Worksheets
if sh.Name < "Sheet1" and sh.name _
< "Sheet2" and sh.Name < "Sheet3" then

' do something with Sh

end if
Next

--
Regards,
Tom Ogilvy

"Corey" wrote in message
...
I have several worksheets that i need to print off.
But since i can add more sheets to this workbook,
i want to be able to print off all the sheets (not by name) except for
about 3 sheets i can name.

Currently i have a macro that specifies each sheet by name then prints 1
page from it.
But as i have now added a couple of sheets to it, i need to keep adding
more code to it to include the newly added sheets.

My thinking is if i can have a code that will print all sheets a
specified page(1) except for,
say sheet1, sheet2 and sheet3.

Is this possible?

Corey....







All times are GMT +1. The time now is 11:50 AM.

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