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

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
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,223,909
Messages
6,175,315
Members
452,634
Latest member
cpostell

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