Option Explicit
Sub CopyForDate()
Dim lRow As Long, Zz As Long, lRow2 As Long
Dim bDem As Integer: Dim Rng As Range
Dim ThuBay As Boolean, ChuNhat As Boolean
Sheet1.Select: Range("A1:C1").Copy Destination:=Sheets("SN").[b5]
lRow = [b65432].End(xlUp).Row: Sheets("SN").Range("C6:D" & lRow).Clear
For Zz = 2 To lRow
With Cells(Zz, 3)
If Day(.Value) = Day(Date) And Month(.Value) = Month(Date) _
And Weekday(Date) = 6 Then ThuBay = True
If Day(.Value) = Day(Date) And Month(.Value) = Month(Date) _
And Weekday(Date) = 6 Then ChuNhat = True
If Day(.Value) = Day(Date) And Month(.Value) = Month(1 + Date) _
Or ThuBay Or ChuNhat Then
If Rng Is Nothing Then
Set Rng = Cells(Zz, 2).Resize(1, 2)
bDem = 1 + bDem
Else
Set Rng = Union(Rng, Cells(Zz, 2).Resize(1, 2))
bDem = 1 + bDem
End If
End If
End With
Next Zz
lRow2 = Sheets("SN").[c65432].End(xlUp).Row + 1
Rng.Copy Destination:=Sheets("SN").Range("C" & lRow2)
Sheets("SN").Range("D" & lRow2).Resize(bDem, 1).Interior.ColorIndex = 7
bDem = 0: Set Rng = Nothing
' * * * * * *'
For Zz = 2 To lRow
With Cells(Zz, 3)
If Day(.Value) = 1 + Day(Date) And Month(.Value) = Month(1 + Date) _
And Weekday(1 + Date) <> 7 Then
If Rng Is Nothing Then
Set Rng = Cells(Zz, 2).Resize(1, 2)
bDem = 1 + bDem
Else
Set Rng = Union(Rng, Cells(Zz, 2).Resize(1, 2))
bDem = 1 + bDem
End If
End If
End With
Next Zz
lRow2 = Sheets("SN").[c65432].End(xlUp).Row + 1
Rng.Copy Destination:=Sheets("SN").Range("C" & lRow2)
Sheets("SN").Range("D" & lRow2).Resize(bDem, 1).Interior.ColorIndex = 39
bDem = 0: Set Rng = Nothing
' * * * * * *'
For Zz = 2 To lRow
With Cells(Zz, 3)
If Day(.Value) = Day(2 + Date) And Month(.Value) = Month(2 + Date) _
And Weekday(1 + Date) <> 1 And Weekday(2 + Date) <> 1 _
And Weekday(1 + Date) <> 7 And Weekday(2 + Date) <> 7 Then
If Rng Is Nothing Then
Set Rng = Cells(Zz, 2).Resize(1, 2)
bDem = 1 + bDem
Else
Set Rng = Union(Rng, Cells(Zz, 2).Resize(1, 2))
bDem = 1 + bDem
End If
End If
End With
Next Zz
lRow2 = Sheets("SN").[c65432].End(xlUp).Row + 1
Rng.Copy Destination:=Sheets("SN").Range("C" & lRow2)
Sheets("SN").Range("D" & lRow2).Resize(bDem, 1).Interior.ColorIndex = 35
bDem = 0: Set Rng = Nothing
Sheets("SN").Select
End Sub