Inserting the Month and Year

T

T. Gomez

I trying to insert the Month and Year only into the header area of my
document, however, I'm only given the numerical choice for inserting
in the customize header portion. I'm guessing that its an easy
switching issue, but I could use some help.
 
J

JE McGimpsey

I trying to insert the Month and Year only into the header area of my
document, however, I'm only given the numerical choice for inserting
in the customize header portion. I'm guessing that its an easy
switching issue, but I could use some help.

You'll need to use VBA to do this. One way:

Put this in the ThisWorkbook code module (ctrl-click the workbook header
and choose View Code):

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim wsSheet As Worksheet
For Each wsSheet In ActiveWorkbook.SelectedSheets
wsSheet.PageSetup.LeftHeader = Format(Date, "mmmm yyyy")
Next wsSheet
End Sub


Change the format as desired.

This will put the date in the left header of every selected sheet in the
workbook. You can use RightHeader or Centerheader, instead.
 

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