Private Sub btnMatricCcarree_Click()
Dim T()
Dim n&, r&, c&, i&, ii&, xij&
n = Cells(65536, 1).End(3).Row
ReDim T(n, 1)
For r = 0 To n
T(r, 0) = Cells(r + 1, 1)
T(r, 1) = Cells(r + 1, 2)
Cells(r + n + 5, 2) = T(r, 0)
Cells(n + 4, 3 + r) = T(r, 0)
Next r
For i = 0 To n - 1
r = n + i + 5
ii = 0
For c = 3 To n + 2
If T(i, 1) = T(ii, 1) Then
Cells(r, c) = 1
xij = xij + 1
Else
Cells(r, c) = 0
End If
ii = ii + 1
Next c
Next i
Cells(n + 4, 2) = xij
Cells(n + 4, 1).Select
End Sub