bonjour à tous,
j'ai adapté un code pour faire une recherchev par vba, et souhaitais l'adapter pour la fonction index equiv.
la formule est celle-ci :
=INDEX(Fe2!B:B;EQUIV(Matrice!C5&Matrice!K5;Fe2!A:A&Fe2!C:C;0))
J'avais essayé de coller par macro celle ci et de l'étirer mais le temps de traitement n'est pas super au vu du nombre de lignes à traiter..
si quelqu'un à une idée ?
merci d'avance
ci- dessous ce que j'ai commencé.
cdt
Sub test_index_equiv()
Dim varRetour As Variant
ligfin = Cells(Cells.Rows.Count, "A").End(xlUp).Row
With Sheets("Matrice")
For x = 4 To ligfin
On Error Resume Next
'on concatene pour recherchev
variable1 = .Range("C" & x).Value & .Range("K" & x).Value
variable2 = Sheets("Fe2").Range("A1:A10000") & Sheets("Fe2").Range("C:C10000")
varRetour = WorksheetFunction.Index(Sheets("Fe2").Range("B1:B" & Cells(65536, 1).End(xlUp).Row), Application.WorksheetFunction.Match(variable1, variable2, 0))
'.Range("E" & x).Value = WorksheetFunction.VLookup(.Range("C" & x).Value, Sheets("Fe3").Range("A1:B" & Cells(65536, 2).End(xlUp).Row), 2, False)
If Not IsNull(varRetour) Then
.Range("F" & x).Value = varRetour
End If
Next x
End With
End Sub