Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Custom Headers and Footers

Hi,
Is it possible to use a formula into headers and footers?


Regards

John

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 11,058
Default Custom Headers and Footers

First put the desired formulas into cells, say A1, A2, A3. Then put the
following macro in the workbook code area:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
.CenterHeader = Range("A2").Value
.RightHeader = Range("A3").Value
End With
Application.ScreenUpdating = True
End If
End Sub

Whenever the sheet is printed, the values of cells A1, A2, and A3 will
appear ing the header.
--
Gary''s Student - gsnu2007g


"John" wrote:

Hi,
Is it possible to use a formula into headers and footers?


Regards

John


  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
external usenet poster
 
Posts: 4
Default Custom Headers and Footers

Gary,
Many thanks but not quite what I wanted.
Doing it that way I would Have to put a macro for every sheet (lots) and
reference each sheet name.
I would have like to have done something simple like "=Sheet1!A1" in the
custom header box but it appears to simple for Excel.
My research into this gave me answers like yours but not entirely what I
need.

Thanks for your efforts


Many thanks again

John

"Gary''s Student" wrote in message
...
First put the desired formulas into cells, say A1, A2, A3. Then put the
following macro in the workbook code area:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
If ActiveSheet.Name = "Sheet1" Then
Application.ScreenUpdating = False
With ActiveSheet.PageSetup
.LeftHeader = Range("A1").Value
.CenterHeader = Range("A2").Value
.RightHeader = Range("A3").Value
End With
Application.ScreenUpdating = True
End If
End Sub

Whenever the sheet is printed, the values of cells A1, A2, and A3 will
appear ing the header.
--
Gary''s Student - gsnu2007g


"John" wrote:

Hi,
Is it possible to use a formula into headers and footers?


Regards

John



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Can I save custom headers and footers to use in other files? Gcwensel Excel Worksheet Functions 1 July 15th 09 02:57 PM
Excel 2003 Too many inherited custom headers and footers Confused Excel Discussion (Misc queries) 0 December 7th 07 04:39 PM
Inserting text into custom headers / footers SyracusePete Excel Discussion (Misc queries) 3 March 22nd 07 03:38 PM
Headers and Footers...oh my! Kim Excel Discussion (Misc queries) 1 September 26th 06 10:24 PM
repeated custom headers and footers Jewelz Excel Discussion (Misc queries) 1 August 30th 05 09:59 PM


All times are GMT +1. The time now is 08:51 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"