Modifying sheet names for Months instead of days

Enzo_Matrix

Board Regular
Joined
Jan 9, 2018
Messages
113
I am using this code:
Code:
Sub NewMonth()' Making a new sheet with the month name changing


Sheets(Format(Date, "mmm")).Copy Before:=Sheets(Sheets.Count)
   ActiveSheet.Name = Format(Date + 1, "mmm")
   Range("A2").Select
End Sub

From my understanding it should change the copied sheet name from 'Mar' to 'Apr'. Instead it changes it from 'Mar' to 'Mar (2)'. Can someone please help me refine my code so it changes the sheets name to the following month.
 

Excel Facts

Links? Where??
If Excel says you have links but you can't find them, go to Formulas, Name Manager. Look for old links to dead workbooks & delete.
If the dates are all the first of the month or close to it, if month end then use a smaller number.
 
Last edited:
Upvote 0
The 31 should be OK.


Excel 2010
ABCD
3801-01-1631-01-16FebFeb
3901-02-1629-02-16MarMar
4001-03-1631-03-16AprApr
4101-04-1630-04-16MayMay
4201-12-1631-12-16JanJan
43
3c
Cell Formulas
RangeFormula
C38=TEXT(A38+31,"mmm")
D38=TEXT(A38+31,"mmm")
 
Last edited:
Upvote 0
I posted an edit to my post but it does not show.


Excel 2010
ABCDEF
381-Jan-1631-Jan-16FebFeb1-Feb-161-Feb-16
391-Feb-1629-Feb-16MarMar3-Mar-163-Mar-16
401-Mar-1631-Mar-16AprApr1-Apr-161-Apr-16
411-Apr-1630-Apr-16MayMay2-May-162-May-16
421-Jan-1831-Jan-18FebFeb1-Feb-181-Feb-18
431-Feb-1828-Feb-18MarMar4-Mar-184-Mar-18
441-Mar-1831-Mar-18AprApr1-Apr-181-Apr-18
451-Apr-1830-Apr-18MayMay2-May-182-May-18
461-May-1831-May-18JunJun1-Jun-181-Jun-18
471-Jun-1830-Jun-18JulJul2-Jul-182-Jul-18
481-Jul-1831-Jul-18AugAug1-Aug-181-Aug-18
491-Aug-1831-Aug-18SepSep1-Sep-181-Sep-18
501-Sep-1830-Sep-18OctOct2-Oct-182-Oct-18
511-Oct-1831-Oct-18NovNov1-Nov-181-Nov-18
521-Nov-1830-Nov-18DecDec2-Dec-182-Dec-18
531-Dec-1831-Dec-18JanJan1-Jan-191-Jan-19
54
3c
Cell Formulas
RangeFormula
C38=TEXT(A38+32-DAY(A38),"mmm")
D38=TEXT(B38+32-DAY(B38),"mmm")
E38=A38+32-DAY(A38)
F38=B38+32-DAY(B38)



01-01-18 Feb 1-Feb-18
31-03-18 Apr 1-Apr-18
 
Last edited:
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