Forum Discussion
Lorenzo Kim
May 28, 2018Bronze Contributor
print in the middle section of header month, year of a cell
I have A1 with date 5/25/2018 >> upper(text(A1,"mmm")) &", " & text(A1,"yyyy") would give MAY, 2018 - how do I put this in the middle section of the HEADER for printing purposes?
or add this to text "REPORT FOR" AT THE LEFT SIDE OF THE HEADER...
no need for vba code.. if possible
many thanks
Can you change the sheet name to "May, 2018" and then insert sheet name in the header? The procedure may take time but it is is a way without using vba,.
- Man Fai ChanIron Contributor
Can you change the sheet name to "May, 2018" and then insert sheet name in the header? The procedure may take time but it is is a way without using vba,.
- Lorenzo KimBronze Contributor
Mr. Chan
I think that is a fantastic way of doing it!!
MANY MANY THANKS
- JKPieterseSilver ContributorThis can only be done using some VBA code I'm afraid.
- Lorenzo KimBronze Contributor
Mr Pieterse
I think Mr Chan have the right idea.
Still, many thanks for your time.
- JKPieterseSilver Contributor
The VBA way is as follows:
- Right-click the tab of the sheet and choose "View Code"
- On the left-had side the project pane should be visible. Your current worksheet is highlighted. In that same list, double-click "ThisWorkbook".
- Paste this code into the window:
Option Explicit Private Sub Workbook_BeforePrint(Cancel As Boolean) Dim oSh As Object For Each oSh In ActiveWindow.SelectedSheets oSh.PageSetup.CenterFooter = Format(Date, "mmm yyyy") Next End Sub
- Lorenzo KimBronze Contributor
Mr Pieterse
Thank you for your reply.
if it is, kindly help with the VBA code..
many many thanks
- Lorenzo KimBronze Contributor
Mr Pieterse
I think Mr Chan have the right idea.
Still, many thanks for your time..