#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 16
Default Formula in a header

Can you put a formula in a header? I would like to get the prior months end
day (7/31/07). in a header? Can this be done? How?

Thanks,
Donna
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 4,624
Default Formula in a header

One way:

Put this in your workbook's ThisWorkbook Code module (if you're not
familiar with macros, see

http://www.mvps.org/dmcritchie/excel/getstarted.htm
)

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim ws As Worksheet
Dim d As Date
d = Date
For Each ws In ActiveWindow.SelectedSheets
ws.PageSetup.LeftHeader = Format(DateSerial(Year(d), _
Month(d), 0), "dd mmm yyyy")
Next ws
End Sub

Substitute CenterHeader or RightHeader, and your favorite date format to
suit.


In article ,
Donna S wrote:

Can you put a formula in a header? I would like to get the prior months end
day (7/31/07). in a header? Can this be done? How?

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
Adding a formula to the header Michelle Excel Discussion (Misc queries) 5 January 5th 09 04:39 PM
If formula in header bg19299 via OfficeKB.com Excel Discussion (Misc queries) 3 August 22nd 06 05:24 PM
Custom Header with Formula Randy Excel Discussion (Misc queries) 6 June 15th 06 12:14 PM
Can you put a formula in a header? bozrdang Excel Discussion (Misc queries) 8 May 16th 06 03:46 AM
Select header if formula Krista F Excel Worksheet Functions 11 April 11th 05 07:26 PM


All times are GMT +1. The time now is 09:11 AM.

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"