Private Sub Worksheet_Change(ByVal Target As Range)
Tags = Array("Conti CQTS ref.", "Vehicule", "Km", "Start of warranty", "Country", "Dealer Brand", "Cal") 'liste des tags à adapter
Dim Prem As Range, col%, flag As Boolean
Set Prem = [PremièreCellule] 'cellule nommée
col = Prem.Column
Application.ScreenUpdating = False
Application.EnableEvents = False
On Error Resume Next
With Intersect(Prem.Resize(Rows.Count - Prem.Row + 1), Me.UsedRange).Columns(2).Resize(, UBound(Tags) + 1)
For Each Target In Intersect(Target, Me.UsedRange).Areas 'si entrées multiples (copier-coller)
flag = True
If Not Intersect(Target, Columns(col), .Cells.EntireRow) Is Nothing Then
flag = False
With Intersect(Target.EntireRow, .Cells)
.FormulaR1C1 = "=RechercheTag(RC" & col & ",COLUMN()-" & col & ")"
.Value = .Value ' 'supprime les formules
End With
End If
If flag Then
With Intersect(Target, .Cells)
.FormulaR1C1 = "=RechercheTag(RC" & col & ",COLUMN()-" & col & ")"
.Value = .Value 'supprime les formules
End With
End If
Next
.Cells(0, 1).Resize(, UBound(Tags) + 1) = Tags 'affichage des tags facultatif ???
.Columns.EntireColumn.AutoFit 'ajustement largeur des colonnes
End With
Application.EnableEvents = True
End Sub