Forum Discussion
Headers and footers - can I include a cell reference?
- Aug 21, 2018
Hi,
This is not possible unless you inject the worksheet with some lines of code!
So please hover the mouse over the worksheet tab, right-click, and select View Code.
Then copy the below code and paste it into the worksheet code module.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C5")) Is Nothing Then
PageSetup.CenterFooter = Range("C5").Value
End If
End SubNext, save the workbook as .xlsm file extension in order to retain the code in the workbook.
I hope that helps
Haytham
Hi,
This is not possible unless you inject the worksheet with some lines of code!
So please hover the mouse over the worksheet tab, right-click, and select View Code.
Then copy the below code and paste it into the worksheet code module.
Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("C5")) Is Nothing Then
PageSetup.CenterFooter = Range("C5").Value
End If
End Sub
Next, save the workbook as .xlsm file extension in order to retain the code in the workbook.
I hope that helps
Haytham
Hello thanks for the code!
I have tried to make it as left footer by changing Line 3 to PageSetup.LeftFooter instead of PageSetup.CentreFooter but it did not work, can you advise how can i get the footer information on the left instead of centre?