Option Explicit
Sub AfficheBarreCouleur()
Dim c As Range
Dim Barre As CommandBar
On Error Resume Next
CommandBars("MaBarre").Delete
On Error GoTo 0
Set Barre = Application.CommandBars.Add("MaBarre", , , 1)
For Each c In Feuil1.Range("Couleurs")
c.CopyPicture
With Barre.Controls.Add(msoControlButton, , , , True)
.PasteFace
.Caption = c.Offset(, 1).Value
.OnAction = "Couleur(" & c.Row & ")"
End With
Next c
Barre.Visible = True
End Sub
Sub couleur(i As Integer)
With Selection
.Interior.Color = Feuil1.Range("Couleurs").Cells(i).Interior.Color
.Value = .Value & Feuil1.Range("Couleurs").Cells(i).Offset(, 2)
End With
End Sub