Function CompteRef(Plage, Mdate)
Dim Tablo, i As Long, Dico
Set Dico = CreateObject("Scripting.Dictionary")
Tablo = Plage
For i = LBound(Tablo) To UBound(Tablo)
If UCase(Tablo(i, 3)) = "ENT" Then
If Tablo(i, 2) >= Mdate And Tablo(i, 2) <= DateSerial(Year(Mdate), Month(Mdate) + 1, 0) Then
Dico(Tablo(i, 1)) = Dico(Tablo(i, 1)) + 1
End If
End If
Next
CompteRef = Dico.Count
End Function