Cell to match footer

T

texansgal

Can someone please give me the formula for a cell to match what the page
header or footer says?

Thanks!
 
J

JP

Here's a series of short UDFs that will give you what you want. Paste
in a standard module (see http://www.rondebruin.nl/code.htm for
placement assistance).

Function GetLeftHeader()
GetLeftHeader = ActiveSheet.PageSetup.LeftHeader
End Function
Function GetCenterHeader()
GetCenterHeader = ActiveSheet.PageSetup.CenterHeader
End Function
Function GetRightHeader()
GetRightHeader = ActiveSheet.PageSetup.RightHeader
End Function
Function GetLeftFooter()
GetLeftFooter = ActiveSheet.PageSetup.LeftFooter
End Function
Function GetCenterFooter()
GetCenterFooter = ActiveSheet.PageSetup.CenterFooter
End Function
Function GetRightFooter()
GetRightFooter = ActiveSheet.PageSetup.RightFooter
End Function


To use: Just put the function name on the cell, prefixed by an equal
sign. For example, to get the left header text in cell A1:

=GetLeftHeader()

If you use this code in your PERSONAL.XLS workbook, you may have to
prefix the code like this:

=PERSONAL.XLS!GetLeftHeader()


HTH,
JP
 

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