Applying a specific Print setting to all worksheets

V

vicky

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 .....
 
D

Dave Peterson

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.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top