Formatting Date to show Month in Customized Header - Can it

eliW

Well-known Member
Joined
Mar 2, 2002
Messages
1,940
Hi all,
I need to show Month instead of
Date in the header of my prints. Can Date be formatted to show Month?

Much appreciation to any hint.

Eli
This message was edited by eliW on 2002-10-02 08:42
 

Excel Facts

How to fill five years of quarters?
Type 1Q-2023 in a cell. Grab the fill handle and drag down or right. After 4Q-2023, Excel will jump to 1Q-2024. Dash can be any character.
Most def.

try this format...

ls_date = Format(ls_date, "dd mmmm yyyy")

works fine for me in my add-in.
 
Upvote 0
On 2002-10-02 06:50, JetPhoenix wrote:
Most def.

try this format...

ls_date = Format(ls_date, "dd mmmm yyyy")

works fine for me in my add-in.
Thank you but can you give me a more detailed explenation?

I know how to format Date to show the month only: it's "mmm".
What I need is to do it in the Page Setup - Customized Header -
Date button.

Eli
 
Upvote 0
I don't know a way to do it without VBA.

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    With ActiveSheet.PageSetup
        .LeftHeader = Format(Now, "MMM")
    End With
End Sub

Right click the Excel icon to the left of File on the menu and choose View Code. Paste in the above.
 
Upvote 0
On 2002-10-02 08:09, Andrew Poulsom wrote:
I don't know a way to do it without VBA.

Code:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
    With ActiveSheet.PageSetup
        .LeftHeader = Format(Now, "MMM")
    End With
End Sub

Right click the Excel icon to the left of File on the menu and choose View Code. Paste in the above.

Thanks a lot Andrew, It works fine.
Just one more question: I'll use this code to put a whole sentence like:
LeftHeader = "Report for " & Format(Now, "MMM,YYYY")

How can I put an underline for this header?

Eli
 
Upvote 0
Like this:

.LeftHeader = "&UReport for " & Format(Now, "MMM,YYYY")

Look up the LeftHeader property in VBA Help and click "format codes" for more options.
 
Upvote 0

Forum statistics

Threads
1,214,935
Messages
6,122,337
Members
449,077
Latest member
Jocksteriom

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top