how to create a module/ marco to make tabs name weekday month day and year

mdiaz211

New Member
Joined
Mar 3, 2021
Messages
3
Office Version
  1. 365
Platform
  1. Windows
hi everyone,

i want to create a module to speed up tab naming which I normally remake them by hand, my tabs the day of the week month day and year for example my tabs would be (Mon March 1, 2021) and next would be the next day and so on.

i found one module from TotallyConfused in a old post which has what i want but not the week if any one can help or explain how to add it to this would be grateful.

Sub CreateMonthlySheets()
'Creates a copy of "Master" sheet for number of days you specify
'It then renames the copies according to the date. e.g. Jan 01 2017
Application.ScreenUpdating = False
Dim Ans As Date
Dim WK As Integer
Dim MO As Integer
Dim DA As Integer
Dim YR As Integer
Dim X As Integer
X = 0
On Error GoTo M

MO = InputBox("Enter month number: (1 - 12)")
DA = InputBox("Enter number of days in the month: (28 - 31)")
YR = InputBox("Enter year: (2017)")
Ans = WK & MO & "/" & 1 & "/" & YR
For X = 1 To DA
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(DateAdd("d", X - 1, Ans), " MMM dd yyyy")
Next
Sheets("Master").Activate
Application.ScreenUpdating = True
Exit Sub
M:
MsgBox "You made an invalid entry."
Application.ScreenUpdating = True
End Sub



 

Excel Facts

Bring active cell back into view
Start at A1 and select to A9999 while writing a formula, you can't see A1 anymore. Press Ctrl+Backspace to bring active cell into view.
hi everyone,

i want to create a module to speed up tab naming which I normally remake them by hand, my tabs the day of the week month day and year for example my tabs would be (Mon March 1, 2021) and next would be the next day and so on.

i found one module from TotallyConfused in a old post which has what i want but not the week if any one can help or explain how to add it to this would be grateful.

Sub CreateMonthlySheets()
'Creates a copy of "Master" sheet for number of days you specify
'It then renames the copies according to the date. e.g. Jan 01 2017
Application.ScreenUpdating = False
Dim Ans As Date
Dim WK As Integer
Dim MO As Integer
Dim DA As Integer
Dim YR As Integer
Dim X As Integer
X = 0
On Error GoTo M

MO = InputBox("Enter month number: (1 - 12)")
DA = InputBox("Enter number of days in the month: (28 - 31)")
YR = InputBox("Enter year: (2017)")
Ans = WK & MO & "/" & 1 & "/" & YR
For X = 1 To DA
Sheets("Master").Copy After:=Sheets(Sheets.Count)
ActiveSheet.Name = Format(DateAdd("d", X - 1, Ans), " MMM dd yyyy")
Next
Sheets("Master").Activate
Application.ScreenUpdating = True
Exit Sub
M:
MsgBox "You made an invalid entry."
Application.ScreenUpdating = True
End Sub



nevermind i found it just add "ddd MMM dd yyyy" and it auto fill lol
thank you
 
Upvote 0
Try changing the line of code that assigns the name, like this:ActiveSheet.Name = Format(DateAdd("d", X - 1, Ans), "ddd MMM dd yyyy")
 
Upvote 0
Solution
Glad having been of some help (y) but I now see that we overlaped :eek:.
 
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,716
Members
448,985
Latest member
chocbudda

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