ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Applying a specific Print setting to all worksheets (https://www.excelbanter.com/excel-programming/436041-applying-specific-print-setting-all-worksheets.html)

vicky

Applying a specific Print setting to all worksheets
 
i have a form which displays the list of all worksheets of its
corresponding workbook... so when i select say for example 1st
worksheet from tat list print setting of the selected sheet should be
applied to all the sheets of tat workbook..... it sounds complex .....
but hope anyone can provide me code snippet for this... or macro to
configure the print setting(like page setup,zoom,margin) and then
applying for all sheets .....

Dave Peterson

Applying a specific Print setting to all worksheets
 
Record a macro when you change a print setting for any of those sheets.

Delete the settings that you don't care about (it'll speed up the code).

Then you could use:

Dim MstrWks as worksheet
dim wks as worksheet

'me.combobox1 contains the worksheet name
set mstrwks = nothing
on error resume next
set mstrwks = activeworkbook.worksheets(me.combobox1.value)
on error goto 0

if mstrwks is nothing then
'nothing chosen (yet)
exit sub???
end if

for each wks in activeworkbook.worksheets
if wks.name = mstrwks.name then
'skip it
else
'do all the work you want.
with wks.PageSetup
.LeftHeader = mstrwks.pagesetup.leftheader
.centerHeader = mstrwks.pagesetup.centerheader
'and on and on...
end with
end if
next wks

There isn't a way to get all those properties as one object.

(untested, uncompiled. Watch for typos.)



vicky wrote:

i have a form which displays the list of all worksheets of its
corresponding workbook... so when i select say for example 1st
worksheet from tat list print setting of the selected sheet should be
applied to all the sheets of tat workbook..... it sounds complex .....
but hope anyone can provide me code snippet for this... or macro to
configure the print setting(like page setup,zoom,margin) and then
applying for all sheets .....


--

Dave Peterson


All times are GMT +1. The time now is 11:58 PM.

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