Header & Footer

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
583
Not sure this is possible, but who knows:

I want to include in the Header (using Page Setup or macro) the ability to use info in the spreadsheet.
Example, I want the Header to say, today's top sales category is T-Shirts. "T-Shirts" would be pulled from cell C4, so the Header should always pull the content of cell C4.

Is this possible?
Thanks
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
You can use the following code to enter the header in the center panel

Code:
Sub HeaderFromCellEntry()

' Macro -- 10/5/02 by Yogi Anand for Header from a cell entry
'
     ActiveSheet.PageSetup.CenterHeader = "Today's Top Category is " & [C4]
End Sub

Regards!

Yogi
This message was edited by Yogi Anand on 2002-10-05 19:10
 

ExcelNovice

Well-known Member
Joined
May 12, 2002
Messages
583
Thanks Yogi, but I can't get this to work...maybe I'm doing something wrong, but its not working.
 

Yogi Anand

MrExcel MVP
Joined
Mar 12, 2002
Messages
11,454
On 2002-10-06 00:17, ExcelNovice wrote:
Thanks Yogi, but I can't get this to work...maybe I'm doing something wrong, but its not working.

The macro that I posted earlier has to be run for the Page Header to include the entry from cell C4.

If you want to have it automated such that whenever you print that sheet, it will use your customized header (including the entry from cell C4), then you can put the code in ThisWorkbook's BeforePrint event ...

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
' Macro -- 10/5/02 by Yogi Anand for Header from a cell entry
'
     ActiveSheet.PageSetup.CenterHeader = "Today's Top Category is " & [C4]
End Sub

Please post back if it works for you ... otherwise explain a little further and let us take it from there.

Regards!

Yogi
 

Forum statistics

Threads
1,144,312
Messages
5,723,650
Members
422,508
Latest member
Lordkit1

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
Top