Re,
J'ouvre ton fichier et je reprends l'énoncé de ton problème :
Pb: J'ai une cellule (fond rouge) qui quand je scanne un produit, la valeur renvoyer est "PI1011057".
Il faut imaginer que tu parles de l'onglet MAIN et que la cellule au soit disant fond rouge a, en réalité, le fond blanc et, comble de mon énervement, est fusionnée.
Tu voudrais que ça change automatiquement. Ton code modifié :
Private Sub Worksheet_Change(ByVal Target As Range)
Dim strAddress As String
Dim val
Dim dtmTime As Date
Dim Rw As Long
Dim DL As Integer
Dim I As Integer
If Not Intersect(Range("D1:E1"), Target) Is Nothing Then
Application.EnableEvents = False
Range("D1:E1").Value = Mid(Target.Value, 5, 3)
Application.EnableEvents = True
DL = Cells(Application.Rows.Count, "M").End(xlUp).Row
For I = 2 To DL
Cells(I, "M").Value = Replace(Cells(I, "M").Value, "P", "")
Next I
Range("M2").Activate
End If
If Not Intersect(Target, Range("M2:M1000")) Is Nothing Then
Rw = Sheets("LOG").Range("A" & Rows.Count).End(xlUp).Row + 1
With Sheets("LOG")
.Cells(Rw, 1) = Now()
.Cells(Rw, 2) = Target.Value
.Cells(Rw, 3) = Target.Address
End With
End If
If Not Intersect(Target, Range("D1")) Is Nothing Then
Rw = Sheets("LOG").Range("A" & Rows.Count).End(xlUp).Row + 1
With Sheets("LOG")
.Cells(Rw, 1) = Now()
.Cells(Rw, 2) = Target.Value
.Cells(Rw, 3) = Target.Address
.Cells(Rw, 4) = "ID PREP"
End With
End If
End Sub