Option Explicit
Sub resetBar(): Application.CommandBars("Cell").Reset: End Sub
Sub barre()
Dim c, Nc, i&
resetBar
With Application.CommandBars("Cell").Controls.Add(msoControlPopup, , , 1)
.Caption = "Couleurs"
c = Array(xlNone, 3, 4, 5, 6) 'index couleur
Nc = Array("Aucune couleur", "Rouge", "Vert", "Bleu", "jaune") ' caption
For i = 0 To UBound(c)
With .Controls.Add(msoControlButton)
.Caption = Nc(i): .OnAction = "couleur"
.Tag = c(i)
With Cells(Rows.Count, Columns.Count): .Interior.ColorIndex = c(i): .CopyPicture: End With
.PasteFace
End With
Next
End With
With Application.CommandBars("Cell").Controls.Add(msoControlPopup, , , 2)
.Caption = "Menu Atteindre"
With .Controls.Add(msoControlButton): .Caption = "selection des visibles": .OnAction = "Atteindre": End With
With .Controls.Add(msoControlButton): .Caption = "copier la partie visible": .OnAction = "CopierVisible": End With
With .Controls.Add(msoControlButton): .Caption = "Valeur cible": .OnAction = "valcible": End With
End With
Cells(Rows.Count, Columns.Count).Interior.ColorIndex = xlNone
End Sub
Sub couleur()
ActiveCell.Interior.ColorIndex = CommandBars.ActionControl.Tag
End Sub
Sub Atteindre(): Selection.SpecialCells(xlCellTypeVisible).Select: End Sub
Sub CopierVisible(): Selection.SpecialCells(xlCellTypeVisible).Copy: End Sub
Sub valcible()
End Sub