1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
|
Private Sub Worksheet_Change(ByVal Target As Range)
Dim FC As Integer, DF As Integer, AM As Integer, PRS As Integer, BATCH As Integer
Dim LaDate As Date
Dim X As Long
Dim Y As Long
Dim Adr As String
If Not Intersect(Target, [F11:ED11]) Is Nothing Then
On Error Resume Next
'faire une recherche sur la variable dans la deuxiéme feuille "cables data"
X = Application.WorksheetFunction.Match(Target.Value, Worksheets("PRS data").Range("A:A"), 0)
On Error GoTo 0
If X = 0 Then
MsgBox "Valeur " & Target.Value & " non trouvée !"
Else
MsgBox "Valeur " & Target.Value & " trouvée dans la ligne : " & X
Adr = Target.Address '<-- stocker la valeur de l'adresse de la cellule dans une variable <-- pour faire quoi ???
Y = Target.Column '<-- stocker le num de colonne changé dans y
With Worsheets("cables data")
'où sont défini ces valeurs (FC, DF, etc...) ???
.Cells(X, 5).Value = FC
.Cells(X, 4).Value = DF
.Cells(X, 8).Value = AM
.Cells(X, 11).Value = PRS
.Cells(X, 12).Value = BATCH
.Cells(X, 13).Value = LaDate
End With
With ActiveSheet
.Cells(14, Y) = FC
.Cells(16, Y) = DF
.Cells(19, Y) = AM
.Cells(34, Y) = PRS
.Cells(35, Y) = BATCH
.Cells(36, Y) = LaDate
End With
End If
End If
End Sub |
Partager