You are on page 1of 1

Sub AddMonthWkst()

Dim ws As Worksheet
Dim strName As String
Dim bCheck As Boolean
On Error Resume Next

strName = Format(Date, "yyyy_mm")


bCheck = Len(Sheets(strName).Name) > 0
ActiveSheet.Range("$A$5:$O$6000").AutoFilter Field:=11, Criteria1:="no"

ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True


ActiveSheet.Select
Range("A5:O6000").Select
Selection.Copy
If bCheck = False Then
Set ws = Worksheets.Add(Before:=Sheets(1))
ws.Name = strName
End If

Sheets(Format(Date, "yyyy_mm")).Select
ActiveSheet.Range("$A$5:$O$6000").Select
ActiveSheet.Paste
Worksheets(strName).Columns("A:O").AutoFit

End Sub