making specific dates in VBA generic so it can be applied continuously

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
I am creating an on-time delivery report and this is the code for one of the steps in my process
Code:
Sub NewDay()'
' NewDay Macro
' Button that initiates new day set up for on-time delivery reports
'
' Keyboard Shortcut: Ctrl+Shift+A
'
    Sheets("Feb 23, 2018").Select
    Sheets("Feb 23, 2018").Copy Before:=Sheets(4)
    Sheets("Feb 23, 2018 (2)").Select
    Sheets("Feb 23, 2018 (2)").Name = "Feb 24, 2018"
    Sheets("Feb 23, 2018").Select
    Range("B2").Select
End Sub

I am wondering if there is a way to make the dates in this code change automatically for today's current date
Would changing
Code:
Sheets("Feb 23, 2018 (2)").Name = "Feb 24, 2018"
' to Sheets("Feb 23, 2018 (2)").Name = Today()
achieve my goal of having the name of the sheets change on their own to the next day in the sequence?
 
Last edited:
If I hide Feb 23, 2018 so that Feb 24, 2018 is the active sheet, it still populates the same way but now sheets are hidden and still sequence:
Feb 23, 2018 (2)
Feb 23, 2018 (3)....

If Feb 24, 2018 is now the active sheet would it not transition the the 25th? and then 26th? How can I make it transition in this manner?
 
Upvote 0

Excel Facts

How to show all formulas in Excel?
Press Ctrl+` to show all formulas. Press it again to toggle back to numbers. The grave accent is often under the tilde on US keyboards.
No. It simply copies today's sheet & renames it with tomorrows date, as that is what your original code was doing.
If that is not what you're after, you'll need to explain exactly what you are trying to do.
 
Upvote 0

Forum statistics

Threads
1,224,827
Messages
6,181,198
Members
453,022
Latest member
RobertV1609

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