Is there a way to make the day's name show up automatically in a header?

Marq

Well-known Member
Joined
Dec 13, 2004
Messages
914
Office Version
  1. 365
  2. 2007
Platform
  1. Windows
I have a form I print out every day..and in the top right custom header I have the &[DATE], which automatically gives the current date in top right corner of form when printed.

I'd also like to have the actual day's name show up automatically under the date. I tried putting below it &[DAY] but it didn't work.

any suggestions how to make this happen?
 
Last edited:
That is how to do it on a Worksheet. I thought you said that you were doing this on a Form.
Choice of words is very important here. Forms are very different than Worksheets.
Is this really a user Form that has been created in VBA, or is it really a worksheet (that you are just calling a Form)?

Note that if this is just a worksheet, you can use the VBA code in the previous link I provided to do this.
It looks like to do what you want will require VBA. It does not appear that it can be done manually.
you are right...my bad...I called it a form because im always asked.."hey..print out that form for me"

it is a worksheet with a custom header.

I can no longer edit my original post to make it say worksheet.
 
Upvote 0

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
You could try the code below
VBA Code:
Sub DayRgtHeader()
   ActiveSheet.PageSetup.RightHeader =""
   ActiveSheet.PageSetup.RightHeader = Date & Chr(10) & Format(Weekday(Date), "dddd")
End Sub
 
Upvote 0
You could try the code below
VBA Code:
Sub DayRgtHeader()
   ActiveSheet.PageSetup.RightHeader =""
   ActiveSheet.PageSetup.RightHeader = Date & Chr(10) & Format(Weekday(Date), "dddd")
End Sub
I copied and pasted it in the into VB code window for that particular sheet and it didn't work.

Do I have to save the workbook as a macro enabled workbook?
 
Upvote 0
It is not sheet code, it goes in a regular module and yes you will need to save it as a macro enabled workbook when you close the workbook.

If you want it as sheet code then try the code below (but it will update every time you activate the sheet).
VBA Code:
Private Sub Worksheet_Activate()
   Me.PageSetup.RightHeader = ""
   Me.PageSetup.RightHeader = Date & Chr(10) & Format(Weekday(Date), "dddd")
End Sub
 
Upvote 0
It is not sheet code, it goes in a regular module and yes you will need to save it as a macro enabled workbook when you close the workbook.

If you want it as sheet code then try the code below (but it will update every time you activate the sheet).
VBA Code:
Private Sub Worksheet_Activate()
   Me.PageSetup.RightHeader = ""
   Me.PageSetup.RightHeader = Date & Chr(10) & Format(Weekday(Date), "dddd")
End Sub
so here is where Im at thus far....I have used some of your code as part of an existing macro I have that populates the headers of my work sheet. So I have one work sheet where I plug some info in selected cells..i click a run macro button and the headers populate with the plugged in info I just mentioned. I put some of your code into my existing marco code.

This is what I used of yours for the right header:

.RightHeader = "&""Arial,Bold""&2" & Date & Chr(10) & Format(Weekday(Date), "dddd")

it works to an extent BUT I am not getting the month.

I click the macro button and when I view the worksheet in print preview I see this in the right header:

/15/2021
Friday

why would I be missing the month in the beginning of the date??
 
Upvote 0
Probably because your font size is too big for the width of the Right section as the amendment you made gives me a font size of 215. The 2 from &2 and the 15 from the start of the date.
 
Upvote 0
Probably because your font size is too big for the width of the Right section as the amendment you made gives me a font size of 215. The 2 from &2 and the 15 from the start of the date.
I make it an &1 and the size is too small but still no month showing in the date.

I have have working with the code like this :

.RightHeader = "&""Arial,Bold""&2" & Format(Date, "m/d/yy") & Chr(10) & Format(Weekday(Date), "dddd")

size is perfect but still no month
 
Upvote 0
Probably because your font size is too big for the width of the Right section as the amendment you made gives me a font size of 215. The 2 from &2 and the 15 from the start of the date.
I got this and it works:

.RightHeader = Format(Date, "m/d/yy") & Chr(10) & Format(Date, "dddd")

But how do I incorporate a font size and bold into it?
 
Upvote 0
How about
VBA Code:
Me.PageSetup.RightHeader = "&""Arial,Bold""&21&D" & Chr(10) & Format(Weekday(Date), "dddd")
This will give 21pt typeface
 
Upvote 0
Solution
How about
VBA Code:
Me.PageSetup.RightHeader = "&""Arial,Bold""&21&D" & Chr(10) & Format(Weekday(Date), "dddd")
This will give 21pt typeface
That works! Thanks....

so, just so I cant keep it off my mind, why wasn't the month showing up in the other variations of the code listed above?!?!?!?
 
Upvote 0

Forum statistics

Threads
1,215,045
Messages
6,122,830
Members
449,096
Latest member
Erald

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