ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   adding cell reference on a header (https://www.excelbanter.com/excel-worksheet-functions/124096-adding-cell-reference-header.html)

Sima

adding cell reference on a header
 
I would like to know if Excel accomdates adding cell references within the
header / footer area so that everytime the contents in that cell within the
worksheet, the header also gets updated and shows up with the updated
information when it is printed.

Gary''s Student

adding cell reference on a header
 
Put something like this in ThisWorkbook code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftHeader = Range("A1").Value
End Sub

Not in a standard module
--
Gary's Student


"Sima" wrote:

I would like to know if Excel accomdates adding cell references within the
header / footer area so that everytime the contents in that cell within the
worksheet, the header also gets updated and shows up with the updated
information when it is printed.


tina

adding cell reference on a header
 
I was searching through the posts and this question mirrors what I'm trying
to do. I right clicked the tab on my spreadsheet, clicked on view code and
then copied/pasted the code listed. The only change I made was the cell
reference (B3). It didn't work and I know I probably did something wrong.
Can someone tell me what step I missed?

Thanks!
--
Tina


"Gary''s Student" wrote:

Put something like this in ThisWorkbook code:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftHeader = Range("A1").Value
End Sub

Not in a standard module
--
Gary's Student


"Sima" wrote:

I would like to know if Excel accomdates adding cell references within the
header / footer area so that everytime the contents in that cell within the
worksheet, the header also gets updated and shows up with the updated
information when it is printed.


Gord Dibben

adding cell reference on a header
 
Tina

The beforeprint code is not sheet code.

It is workbook code.

Right-click on the Excel icon left of "File" on the menu bar or on the Excel
icon at left end of title bar if not maximized.

Select "View Code" to open the Thisworkbook module.

Paste the code into that module.


Gord Dibben MS Excel MVP

On Wed, 28 Mar 2007 13:42:03 -0700, Tina wrote:

I was searching through the posts and this question mirrors what I'm trying
to do. I right clicked the tab on my spreadsheet, clicked on view code and
then copied/pasted the code listed. The only change I made was the cell
reference (B3). It didn't work and I know I probably did something wrong.
Can someone tell me what step I missed?

Thanks!



tina

adding cell reference on a header
 
Works like a charm.....Thank you!
--
Tina


"Gord Dibben" wrote:

Tina

The beforeprint code is not sheet code.

It is workbook code.

Right-click on the Excel icon left of "File" on the menu bar or on the Excel
icon at left end of title bar if not maximized.

Select "View Code" to open the Thisworkbook module.

Paste the code into that module.


Gord Dibben MS Excel MVP

On Wed, 28 Mar 2007 13:42:03 -0700, Tina wrote:

I was searching through the posts and this question mirrors what I'm trying
to do. I right clicked the tab on my spreadsheet, clicked on view code and
then copied/pasted the code listed. The only change I made was the cell
reference (B3). It didn't work and I know I probably did something wrong.
Can someone tell me what step I missed?

Thanks!





All times are GMT +1. The time now is 03:05 AM.

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