Macro to set headers for all worksheets in a workbook

bhrjohnson

Board Regular
Joined
Oct 8, 2004
Messages
56
I would like to create a macro that will set the following parameters for every WS in a WB....

Left header: blank
Right Header: [Name of worksheet]
Center Header: [description for 2-letter code - see notes below]

Center Header Notes: All but 4 of the WSs are titled with a 2-letter code (Ex: AB, AU, LV, etc.). The 2-letter codes correspond to descriptions which are listed in the WS titled "Code Guide". In the code guide WS column A contains the 2-letter code and column B contains each corresponding description. Ex:

BL Balanced Funds
AU Gold Funds
LV Large-Cap Value

What I am trying to do is add a center header just for the 46 or so worksheets that contain a 2-letter code. In the center header I want to see the description that corresponds to the worksheet title code.

Ex: The worksheet titled "BL" should have a center header that reads "Balanced Funds".


Anyone of you gurus able to figure that one out? I tried to tackle this about a year ago and posted the same topic but we couldn't get the center header to work.

Thanks,
Bill
 
It's working now. There was a new code in this run of data that was not yet on my code guide and it was hanging up on that one. I added the code in and now it works.

Any thoughts on how to get each WS to then default to scrolling up to the top?

Thanks,
Bill
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"

Forum statistics

Threads
1,214,865
Messages
6,121,988
Members
449,060
Latest member
mtsheetz

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top