Option Explicit
Sub compter_mail()
Application.ScreenUpdating = False
Dim cel As Range, plage As Range, Data1 As String, Data2 As String
Dim nb As Integer ', i As Integer, j As Integer
Data1 = Sheets("data").Range("A2")
Data2 = Sheets("data").Range("A3")
nb = 0
Set plage = Sheets("test mail").Range("a1:a" & Sheets("test mail").Range("A" & Rows.Count).End(xlUp).Row)
For Each cel In plage
If cel.Value = Data1 And cel.Offset(1, 0).Value Like Data2 Then
nb = nb + 1
End If
Next cel
Data1 = Right(Data1, Len(Data1) - 5)
Data2 = Right(Data2, Len(Data2) - 1)
Data2 = Left(Data2, Len(Data2) - 1)
MsgBox Data1 & " a envoyé " & (nb) & " mails."...