[COLOR="DarkSlateGray"]Private Sub Worksheet_Change(ByVal Target As Range)
Dim uTarget As Range, oCel As Range, lCol As Long, i As Long
[B][COLOR="SeaGreen"]'-------------- Les lignes à adapter sont les lignes commentées. --------------[/COLOR][/B]
Set uTarget = Intersect(Target, Columns([B]1[/B])) [B][COLOR="SeaGreen"]'Zone à traiter[/COLOR][/B]
If Not uTarget Is Nothing Then
Application.ScreenUpdating = False
lCol = [B]26[/B] [B][COLOR="SeaGreen"]'Rang de la dernière colonne à formater (26 <=> colonne Z)[/COLOR][/B]
With Sheets("[B]Feuil2[/B]").Range("[B]A2:A11[/B]") [B][COLOR="SeaGreen"]'Zone des formats-modèles.[/COLOR][/B]
For Each oCel In uTarget.Cells
For i = 1 To .Rows.Count
If UCase(oCel.Value) = UCase(.Cells(i, 1).Value) Then Exit For
Next i
If i < 1 + .Rows.Count Then
Application.EnableEvents = False
.Cells(i, 1).Copy
oCel.Resize(1, 1 + lCol - uTarget.Column).PasteSpecial _
Paste:=xlPasteFormats
Application.CutCopyMode = False
Application.EnableEvents = True
End If
Next oCel
End With
uTarget.Select
Application.ScreenUpdating = True
End If
Set uTarget = Nothing
End Sub[/COLOR]