Private Sub Worksheet_Change(ByVal Target As Range)
' Code déja dans Worksheet_Change
Dim i&
Set Target = Intersect(Target, [V:V], UsedRange)
Application.ScreenUpdating = False
Application.EnableEvents = False 'désactive les évènements
On Error Resume Next
With Feuil3 'CodeName à adapter
If .FilterMode Then .ShowAllData 'si la feuille est filtrée
For Each Target In Target 'si entrées/effacements multiples
If Target.Row > 1 Then
If LCase(Target) = "t" Then
i = 0
i = Application.Match(Target(1, 0), .Columns(1), 0)
If i = 0 Then i = .Cells(.Rows.Count, 1).End(xlUp).Row + 1: .Cells(i, 1) = Target(1, -20)
'Hyperlinks.Add Target(1, 2), "", .Name & "!" & .Cells(i, 1).Address(0, 0), TextToDisplay:="OA"
ElseIf Target = "" Then
Target(1, 2).Clear 'RAZ
.Rows(Application.Match(Target(1, -19), .Columns(1), 0)).Delete
End If
End If
Next
End With
[V:V].HorizontalAlignment = xlCenter 'centrage
Application.EnableEvents = True 'réactive les évènements
' Code pour doublons
Dim tablo, d As Object, i&, v, e, n&, resu(), a, b
tablo = Range("A1:B" & Cells.SpecialCells(xlCellTypeLastCell).Row) 'matrice, plus rapidee, au moins 2 éléments
Set d = CreateObject("Scripting.Dictionary")
For i = 1 To UBound(tablo)
v = tablo(i, 1)
If v <> "" Then d(v) = d(v) + 1
Next i
For Each e In d.keys
If d(e) = 1 Then d.Remove e
Next e
n = d.Count
'---transposition---
If n Then
ReDim resu(1 To n, 1 To 2)
a = d.keys: b = d.items
For i = 1 To n
resu(i, 1) = a(i - 1): resu(i, 2) = b(i - 1)
Next
End If
'---restitution---
Application.EnableEvents = False
With [C4] '1ère cellule de destination
If n Then .Resize(n, 2) = resu
.Offset(n).Resize(Rows.Count - n - .Row + 1, 2).ClearContents 'RAZ en dessous
End With
Application.EnableEvents = True
End Sub