Aug 02 2019 03:06 AM
I am creating a multisheet workbook where I want to insert the contens of a cell into the pagefoot, is that possible and in that case how.
Aug 02 2019 05:43 AM - edited Aug 02 2019 05:46 AM
SolutionHi
Although you can add different types of information to the Header or Footer (File Name, Sheet Name, Date, ...etc), however, using the Page Setup dialog box, you cannot grab a value from a cell in the worksheet by typing =cellReference
The Good News is, You can create a very simple code in VBA to do that for you.
The code should be attached to the Before Print Event of the Workbook:
Here is the code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Sh As Worksheet
For Each Sh In Me.Worksheets
Sh.PageSetup.CenterFooter = Sh.Range("C5").Value & VBTab & Date
Next Sh
End Sub
NB: To have in the Header use CenterHeader instead
VBTab will add a Space and I am joining to the Date
Hope that Helps
Nabil Mourad
Aug 02 2019 05:43 AM - edited Aug 02 2019 05:46 AM
SolutionHi
Although you can add different types of information to the Header or Footer (File Name, Sheet Name, Date, ...etc), however, using the Page Setup dialog box, you cannot grab a value from a cell in the worksheet by typing =cellReference
The Good News is, You can create a very simple code in VBA to do that for you.
The code should be attached to the Before Print Event of the Workbook:
Here is the code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim Sh As Worksheet
For Each Sh In Me.Worksheets
Sh.PageSetup.CenterFooter = Sh.Range("C5").Value & VBTab & Date
Next Sh
End Sub
NB: To have in the Header use CenterHeader instead
VBTab will add a Space and I am joining to the Date
Hope that Helps
Nabil Mourad