Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
Dim C As Range
If Left(Sh.Name, 3) <> "tab" Then Exit Sub
If Target.Address = "$K$11" Then
If Not IsDate(Target(1)) Or Target.Count > 1 Then Exit Sub
If Day(Target) <> 1 Then Exit Sub
Application.EnableEvents = False
[C11:C41,I11:I41].Value = 0
[K12:K41] = ""
Rows("12:41").Hidden = False
With Target.Resize(DateSerial(Year(Target), Month(Target) + 1, 1) - Target)
.NumberFormat = Target.NumberFormat
.DataSeries
End With
With Application
If .CountA([K39:K41]) < 3 Then
Rows(41).Offset(-2 + .CountA([K39:K41])).Resize(3 - .CountA([K39:K41])).Hidden = True
End If
End With
Application.EnableEvents = True
ElseIf Not Intersect(Target, [C11:C41,I11:I41]) Is Nothing Then
Application.EnableEvents = False
For Each C In Intersect(Target, [C11:C41,I11:I41])
If Application.Weekday(Cells(C.Row, 11), 2) > 5 Then
C.Value = 0
End If
Next C
Application.EnableEvents = True
End If
End Sub