Formatting footer

chadski778

Active Member
Joined
Mar 14, 2010
Messages
297
I would like code to automatically add the current date in each tab of my workbook as a right footer in page set-up. How do i do this without the date changing each time the file is opened? How do you keep the date constant?
 

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result
Hard-code the date if you don't want it to change.
Code:
Sub rf()
    Dim ws As Worksheet
    For Each ws In ActiveWorkbook.Worksheets
        ws.PageSetup.RightFooter = "31/08/2011"
    Next
End Sub
Or maybe:
Code:
        If ws.PageSetup.RightFooter = "" Then ws.PageSetup.RightFooter = Format(Date, "ddddd")
If want to set it to the current date only the first time the procedure is run (assuming the right footer is empty).
 
Upvote 0
Have you tried recording the manual steps with the macro recorder? This should give you a starting point for tweaking the code.
 
Upvote 0
Thanks John.

Noting steps through macro recorder helped.

I tried using MS VB help feature, but their syntax seems to be wrong from what is actually required.
 
Upvote 0

Forum statistics

Threads
1,224,618
Messages
6,179,917
Members
452,949
Latest member
beartooth91

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