1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
| Private Sub Worksheet_Change(ByVal Target As Range)
Dim Wb As Workbook, c As Range, f As Worksheet, Ref As Range, NumLigne As Integer, Nom$, Prix As Single
On Error Resume Next
Set Wb = Workbooks("Informations.xls")
If Wb Is Nothing Then Exit Sub
On Error GoTo 0
Set f = Wb.Sheets(1)
Set Ref = Intersect(f.Range("B:B"), f.UsedRange)
If Not Intersect(Target, Range("A:A")) Is Nothing Then
For Each c In Intersect(Target, Range("A:A"))
On Error Resume Next
NumLigne = Application.Match(c, Ref, 0)
On Error GoTo 0
If NumLigne <> 0 Then
Application.EnableEvents = False
c.Offset(0, 1) = f.Range("C" & NumLigne)
c.Offset(0, 2) = f.Range("I" & NumLigne)
Application.EnableEvents = True
End If
Next
End If
End Sub |
Partager