View Single Post
 
Old 04-20-2021, 05:21 PM
macropod's Avatar
macropod macropod is online now Windows 10 Office 2016
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Even simpler:
Code:
Sub InsertNewWorksheetAndName()
Application.ScreenUpdating = False
With ActiveWorkbook
  .Sheets.Add After:=Worksheets(.Worksheets.Count)
  .Sheets(.Worksheets.Count).Name = Format(DateAdd("M", -1, Now()), "YYYY-MM")
End With
Application.ScreenUpdating = True
End Sub
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote