Bonjour,
Une solution (mais cette solution est fortement déconseillée)
Sub Creation_Mon_Menu()
Dim MaBarre As CommandBar
Dim i As Integer, Mg As String
On Error Resume Next
Application.CommandBars("ClicDroit").Delete
Set MaBarre = Application.CommandBars _
.Add(Name:="ClicDroit", Position:=msoBarPopup)
For i = 1 To [N1].Value
Mg = Range("O" & i)
With MaBarre
.Controls.Add Type:=msoControlButton
.Controls(i).OnAction = "Act" & Mg
.Controls(i).Caption = Mg
End With
Next i
MaBarre.ShowPopup
End Sub
Sub ActA(): Com ("A"): End Sub
Sub ActB(): Com ("B"): End Sub
Sub ActC(): Com ("C"): End Sub
Sub Com(M$)
Dim Ws As Worksheet
Dim Nblg As Long
Application.ScreenUpdating = False
Set Ws = Sheets("Feuil1")
Nblg = Ws.Range("A" & Rows.Count).End(xlUp).Row
If FeuilleExiste(M) = False Then
Sheets.Add after:=Sheets(Sheets.Count)
ActiveSheet.Name = M
Ws.Select
End If
Sheets(M).Cells.Clear
With Ws.Range("A1:C" & Nblg)
.AutoFilter field:=1, Criteria1:=M
.SpecialCells(xlCellTypeVisible).Copy Sheets(M).Range("A1")
.AutoFilter
End With
Application.ScreenUpdating = True
End Sub
Une solution du type Banzai64 est sans doute bien préférable (quitte à rendre le Combo invisible et à ne le montrer qu'après appui sur le bouton)
A+