With Worksheets('Commandes")
Cells(Target.Row, "U").Value = .Cells(WorksheetFunction.Match(Target.Value, .Columns("L"), 0), "J").Value
End With
Ou pour parer à un éventuel problème :
VB:
Dim L as Long
With Worksheets('Commandes")
On Error Resume Next: L = WorksheetFunction.Match(Target.Value, .Columns("L"), 0)
If Err Then L = 0
On Error GoTo 0
If L > 0 Then Cells(Target.Row, "U").Value = .Cells(L, "J").Value
End With
bonsoir
et la gestion erreur du non match alors????
VB:
With Worksheets("Commandes").Cells(Target.Row, "U")
x = Application.IfError(Application.Match(Target.Value, .Columns("L"), 0), 0)
.Value = IIf(x = 0, .Value,.Cells(x, "J")
End With
Bonjour.
Ça ne marchera toujours pas, parce qu'avec Target.Row = 10 et x =100 par exemple,
MsgBox Cells(Target.Row, "U").Cells(x, "J").Address affiche "$AD&109" et non "$J$100"
re
bonjour @Dranreb
??????????????????????????????????????????????????????????????
mon code ne veut absolument pas dire
MsgBox Cells(Target.Row, "U").Cells(x, "J").Address affiche "$AD&109" et non "$J$100"
quel est l’intérêt de coder ça MsgBox Cells(Target.Row, "U").Cells(x, "J")
With Worksheets("Commandes").Cells(Target.Row, "U")
x = Application.IfError(Application.Match(Target.Value, .Columns("L"), 0), 0)
.Value = IIf(x = 0, .Value,.parent.Cells(x, "J")
End With