header/footer link to cell?

S

Suzanne

Is there a way to link the header and/or footer to a
specific cell so that it will automatically update?

Thanks
Suzanne
 
F

Frank Kabel

Hi
you'll need VBA for this. Put the following
code in your workbook module (not in a standard module):
Private Sub Workbook BeforePrint(Cancel As Boolean)
Dim wkSht As Worksheet
For Each wkSht In me.Worksheets
With wkSht.PageSetup
.CenterFooter = .range("A1").value
End With
Next wkSht
End Sub

this links cell A1 of each sheet to the footer
 
S

Suzanne

Ok, this may be a little advanced for me, what is VBA?
and is there a basic site you can suggest for intro to
VBA? Also, with this VBA function will it automatically
place it on my chart worksheets? And if I need a header
do I change your formula to .centerheader=.range
("A1").value ?
 
F

Frank Kabel

Hi
for getting started with VBA see:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

As this is an event procedure also see:
http://www.cpearson.com/excel/events.htm

Currently this won't work for charts. If you want to include them use
Private Sub Workbook BeforePrint(Cancel As Boolean)
Dim wkSht
For Each wkSht In me.Sheets
With wkSht.PageSetup
.CenterFooter = .range("A1").value
End With
Next wkSht
End Sub

to also cycle through chart sheets

And yes you could use .centerheader
 

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