Changing (Part of) Header Without Changing Footer or Rest of Header

P

Paul Cross

I've got many sheets that have the same left header but all have
different right header sections and different footers. I'd like to
create code that makes the same change to the left header of all the
sheets BUT leaves the rest of the header, and footer, alone. Is this
possible?

I don't want to edit code for each of the sheets - that's why I'm
looking for the magical "leave the rest alone" snippet. Is it
anywhere?

Thank you for advice!

-- Paul Cross
 
F

Frank Kabel

Hi
try
sub change_left_header()
dim wks as worksheets
for each wks in activeworkbook.worksheets
with wks.pagesetup
.leftheader = "your new header"
end with
next
end sub
 
P

Paul Cross

Thank you kindly. This appeared to work for me after dropping the 's'
in the declaration line ("dim wks as worksheet"). This will be very
useful to me.

-- Paul Cross
 
Top