ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Select multiple sheets on a dinamic context (https://www.excelbanter.com/excel-programming/398480-select-multiple-sheets-dinamic-context.html)

bliten_bsas

Select multiple sheets on a dinamic context
 
Hi, I've built a model in which the user is able to add new sheets and
I'd like to make a print macro that selects only certain sheets. The
catch is that there are certain sheets which I don't want to print and
there will be new sheets (added by the user) that should be printed...
How could I do this?


Zone[_3_]

Select multiple sheets on a dinamic context
 
You could use an array, like so:

Sub PrintSome()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets(Array("Sheet1", "Sheet3"))
ws.PrintOut
Next ws
End Sub

James

"bliten_bsas" wrote in message
ps.com...
Hi, I've built a model in which the user is able to add new sheets and
I'd like to make a print macro that selects only certain sheets. The
catch is that there are certain sheets which I don't want to print and
there will be new sheets (added by the user) that should be printed...
How could I do this?




Curt

Select multiple sheets on a dinamic context
 
was sure surprised to run into this. Just down my alley.
useing this code I have many sheets some named others numbered. should the
numbered sheets be refered to by number only? not as "sheet1" only "1".
Anyway I will start and see what happens
Thanks

"Zone" wrote:

You could use an array, like so:

Sub PrintSome()
Dim ws As Worksheet
For Each ws In ThisWorkbook.Worksheets(Array("Sheet1", "Sheet3"))
ws.PrintOut
Next ws
End Sub

James

"bliten_bsas" wrote in message
ps.com...
Hi, I've built a model in which the user is able to add new sheets and
I'd like to make a print macro that selects only certain sheets. The
catch is that there are certain sheets which I don't want to print and
there will be new sheets (added by the user) that should be printed...
How could I do this?






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

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