Public Function T7CN(ByVal ID As String, ByVal rngID As Range, ByVal rngDate As Range) As Long
Dim arrID As Variant, arrDate As Variant
Dim Dic As Object
Dim i&, j&
Set Dic = CreateObject("Scripting.Dictionary")
arrID = rngID.Value
arrDate = rngDate.Value2
For i = 1 To UBound(arrID)
If arrID(i, 1) = ID Then
For j = arrDate(i, 1) To arrDate(i, 2)
If Weekday(j, vbMonday) = 6 Then
If Dic.Exists(j) = False Then
Dic.Item(j) = ""
T7CN = T7CN + 1
End If
ElseIf Weekday(j, vbMonday) = 7 Then
If Dic.Exists(j) = False Then
Dic.Item(j) = ""
T7CN = T7CN + 2
End If
End If
Next j
End If
Next i
End Function