Vincent88
Active Member
- Joined
- Mar 5, 2021
- Messages
- 382
- Office Version
- 2019
- Platform
- Windows
- Mobile
Hi Everybody, Need help to modify the code to create consecutive month sheets. ( if 2021_07 exists, then 2021_08 and so on).
VBA Code:
Sub AddMonthWkst()
Dim ws As Worksheet
Dim wsM As Worksheet
Dim strName As String
Dim bCheck As Boolean
On Error Resume Next
Set wsM = Sheets("202106")
strName = Format(Date, "yyyymm")
'bCheck = Len(Sheets(strName).Name) > 0
If bCheck = False Then
'add new sheet after Instructions
wsM.Copy Before:=Sheets(1)
ActiveSheet.Name = strName
End If
Set wsM = Nothing
End Sub