Sub test2()
Dim i&, r As Range, sDat(0 To 21, 0 To 5), x()
x = Array(Array(3, 1, 0, 0, 3, 1), Array(1, 1, 1, 0, 0, 0))
With [C5:AN24] '[B3:AM22] dans le fichier 111.xls de phlaurent55
For Each r In .Rows
For i = 0 To 5: sDat(r.Row - .Row, i) = compte(r, CStr(x(0)(i)), CBool(x(1)(i))): Next
Next
.Offset(0, .Columns.Count).Resize(, 1 + UBound(sDat, 2)).Value = sDat
End With
End Sub
Private Function compte(r As Range, s$, Optional tf As Boolean = True)
Dim tmp&, oCel As Range
For Each oCel In r.Cells
tmp = (Not IsEmpty(oCel)) * (tmp + 1) * ((CStr(oCel.Value) = s) = tf)
compte = compte - (tmp > compte)
Next
End Function