Text and Date in VBA

Zanatos

Board Regular
Joined
May 18, 2007
Messages
65
Hey, I am trying to add text and a date to my spreadsheet in a footer via VBA, the formating for the date is what is making this difficult.

This is what I want

Rev. June 28, 2008


I can get the date to show up in that format, but I cannot add any text (the "Rev.") to the front of it. The code I am using for the date is shown below (note: I deleted ALOT of code that was irrelevant to this)




Private Sub CommandButton3_Click() ' Print Details
ActiveSheet.PageSetup.PrintArea = "DetailsMS"
With ActiveSheet.PageSetup

.CenterFooter = Format(Now(), "[$-409]mmmm dd, yyyy")

End With
ActiveWindow.SelectedSheets.PrintPreview
Range("A2:K37").BorderAround Weight:=xlMedium
End Sub
 

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

iggydarsa

Well-known Member
Joined
Jun 28, 2005
Messages
1,734
Office Version
  1. 2019
Platform
  1. Windows
did you try this?

Code:
.CenterFooter = "Rev. " & Format(Now(), "[$-409]mmmm dd, yyyy")
 
Upvote 0

Zanatos

Board Regular
Joined
May 18, 2007
Messages
65
That worked. I had tried many things simular, but I guess I was always missing a " somewhere or something. It had been a long day.

Thanks!
 
Upvote 0

Forum statistics

Threads
1,191,165
Messages
5,985,034
Members
439,935
Latest member
Monty238

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
Top