1- j'ai trouvé une astuce pour que après avoir entré une référence, même en tapant sur entrée, le curseur se positionne sur la qualtité à rentrer
2- j'ai aussi mis une recherche non seulement en amont mais aussi en aval de la référence entrée
Bon le code se complexifie
Option Explicit
Private Sub Worksheet_Change(ByVal Target As Range)
Dim cherche As Range, plage As Range
If Target.CountLarge > 1 Then Exit Sub
If Target.Value = "" Then Exit Sub
If Target.Row = 1 Then Exit Sub
' modification en colonne B
If Not Intersect(Target, Columns("B")) Is Nothing Then
Target.Offset(, 5).Value = Target.Offset(, 5).Value + Target.Value
Range("A" & Rows.Count).End(xlUp).Offset(1, 0).Select
' modificatoin en colonne A
ElseIf Not Intersect(Target, Columns("A")) Is Nothing Then
' recherche en amont s'il y a doublon
Set plage = Range("A1:A" & Target.Row - 1)
Set cherche = plage.Find(Target.Value)
If Not cherche Is Nothing Then
Application.EnableEvents = False
Application.Undo
cherche.Offset(0, 1) = ""
Application.EnableEvents = True
cherche.Offset(0, 1).Select
Else
' recherche an aval s'il y a doublon
Set plage = Range("A" & Target.Row + 1 & ":A" & Rows.Count)
Set cherche = plage.Find(Target.Value)
If Not cherche Is Nothing Then
Application.EnableEvents = False
Application.Undo
cherche.Offset(0, 1) = ""
Application.EnableEvents = True
cherche.Offset(0, 1).Select
Else
Target.Offset(0, 1).Select
End If
End If
End If
End Sub