ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Changing (Part of) Header Without Changing Footer or Rest of Header (https://www.excelbanter.com/excel-programming/298843-changing-part-header-without-changing-footer-rest-header.html)

Paul Cross

Changing (Part of) Header Without Changing Footer or Rest of Header
 
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

Frank Kabel

Changing (Part of) Header Without Changing Footer or Rest of Header
 
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

--
Regards
Frank Kabel
Frankfurt, Germany


Paul Cross wrote:
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


Paul Cross

Changing (Part of) Header Without Changing Footer or Rest of Header
 
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



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

--
Regards
Frank Kabel
Frankfurt, Germany


Frank Kabel

Changing (Part of) Header Without Changing Footer or Rest of Header
 
Hi
sorry, this was a typo on my side :-)

--
Regards
Frank Kabel
Frankfurt, Germany

"Paul Cross" schrieb im Newsbeitrag
m...
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



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

--
Regards
Frank Kabel
Frankfurt, Germany




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

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