Sub Résultat()
Dim t, ub%, i&, j%
With Feuil3 'CodeName de la feuille Résultat
.[A:I].Clear 'RAZ
[A:I].Copy .[A1]
t = .UsedRange.Resize(.UsedRange.Rows.Count + 1).Formula 'matrice, plus rapide, au moins 2 éléments
ub = UBound(t, 2)
For i = 1 To UBound(t) - 1
For j = 1 To ub
If Left(t(i, j), 3) = "**C" Then t(i, j) = ChercheTruc(CStr(t(i, j)))
Next j, i
.UsedRange = t 'restitution
.Columns.AutoFit 'ajustement largeur
.Activate 'facultatif
End With
End Sub
Function ChercheTruc(t$)
Dim s, col1%, col2%, truc, i&
ChercheTruc = ""
On Error Resume Next
s = Split(t, "**C")
col1 = Val(s(1))
col2 = Val(s(2))
truc = Mid(s(1), InStr(s(1), "=") + 1)
If IsNumeric(truc) Then truc = CDbl(truc)
With Feuil2 'CodeName de la feuille
i = Application.Match(truc, .Columns(col1), 0)
ChercheTruc = .Columns(col2).Cells(i)
End With
End Function