How do I put a specific cells information in the header or footer.

B

bannshy9

I am wondering if it is possible to put the info from a specific cell in a
excel workbook into the Header or Footer
 
M

MasterMikey

I am wondering if it is possible to put the info from a specific cell in a
excel workbook into the Header or Footer

The only way you can include info from a specific cell is to use Excel
VBA:

You can include the value of a cell in the header. For example, the
following code will put the value of cell B5 on Sheet2 into the header
of the activesheet.

ActiveSheet.PageSetup.LeftHeader = _
Format(Worksheets("Sheet2").Range("B5").Value)
 
B

Bob Umlas, Excel MVP

You need to use VBA to do that. Right-click the Excel LOGO (Near the file
menu) and select View Code, paste this in (edit it to suit):
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.LeftHeader = Range("A12").Value
End Sub
Bob Umlas
Excel MVP
 

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