Function holding(t, racine, participant)
Dim a(100, 100)
Dim pct(100, 100)
searchmaster t, racine, participant, a, pct, 0
pctt = 0
For i = 1 To a(0, 0)
pctlg = 1
For j = 1 To a(i, 0)
If pct(i, j) <> 0 Then
pctlg = pctlg * pct(i, j)
End If
Next j
pctt = pctt + pctlg
Next i
holding = pctt
End Function
private Sub searchmaster(t, racine, participant, ByRef a, ByRef pct, n)
For Each r In t.Rows
If r.Cells(1, 2) = participant Then
If n = 0 Then
a(0, 0) = a(0, 0) + 1
l = a(0, 0)
Else
l = a(0, 0)
If a(l, a(l, 0)) = racine Then
a(0, 0) = a(0, 0) + 1
l = a(0, 0)
i = 0
While a(l - 1, i) <> participant
a(l, i) = a(l - 1, i)
pct(l, i) = pct(l - 1, i)
i = i + 1
Wend
a(l, 0) = a(l, 0) - 2
End If
End If
a(l, 0) = a(l, 0) + 1
c = a(l, 0)
a(l, c) = participant
pct(l, c) = r.Cells(1, 3)
If r.Cells(1, 1) <> racine Then
searchmaster t, racine, r.Cells(1, 1), a, pct, n + 1
Else
a(l, 0) = a(l, 0) + 1
c = a(l, 0)
a(l, c) = racine
pct(l, c) = 1
End If
End If
Next
End Sub