How to reference a text cell that changes weekly in Header or Foo.

G

Guest

In LOTUS 1-2-3 in the Header or Footer you can reference a text cell in the
worksheet and have the contents appear in the Header/Footer. The text cell
referenced changes weekly for date or some other text and this command puts
the text automatically in the Header/Footer. How do you do this in EXCEL/
 
B

Bob Phillips

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet.PageSetup
.LeftFooter = Format(Date, "dd mmm yyyy")
End With
End Sub

'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code

--

HTH

RP
(remove nothere from the email address if mailing direct)
 
G

Guest

You need a macro. Right-click the Excel LOGO near the File menu, select View
Code, enter this (this example assumes you want the contents of cell D1 in
the right header:)
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.RightHeader = Range("D1").Value
End Sub

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top