1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
| Public cb As CommandBar
Sub popupselectioncouleur()
Dim liste As Range
Set liste = Range("liste")
If liste.Column > 1 Then Exit Sub
Dim i As Long, nbl As Long
On Error Resume Next
CommandBars("Menu_Gw").Delete
On Error GoTo 0
Set cb = Application.CommandBars.Add("Menu_Gw", msoBarPopup)
nbl = liste.Count
For i = 1 To nbl
With cb.Controls.Add(msoControlButton, 1, , , True)
.Caption = liste(i)
.OnAction = "gw_lance(" & i & ")"
End With
Next i
cb.ShowPopup
End Sub
Sub gw_lance(index As Long)
ActiveCell = cb.Controls(index).Caption
End Sub |
Partager