1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Sub VL_date_invest()
Dim c As Range, ShVL As Worksheet, Plage As Range, Ligne As Long, Col As Variant
Dim x As Range
Set ShVL = Sheets("VL")
With Sheets("test")
Set Plage = .Range(.[A2], .Cells(.Rows.Count, 1).End(xlUp)) 'modifier le 1, A2 cellule de recherche
End With
With ShVL
For Each c In Plage
Set x = .Columns(1).Find(c.Value, , , xlWhole)
If Not x Is Nothing Then
Col = Application.Match(c.Offset(, 1).Value * 1, .Rows(1), 0)
If Not IsNumeric(Col) Then
Col = Application.Match(c.Offset(, 1).Value * 1 + 1, .Rows(1), 0)
End If
If IsNumeric(Col) Then
c.Offset(, 2) = Application.Index(.Cells, x.Row, Col).Value
End If
End If
Next c
End With
End Sub |