Check this code and change in places marked
![]()
Sub ADD_MENU() Dim cbMainMenuBar As CommandBar Dim cbcCutomMenu As CommandBarControl 'reset the commandbar Application.CommandBars("Worksheet Menu Bar").Reset On Error Resume Next Application.CommandBars("Worksheet Menu Bar").Controls("&Split Data Based On Column Value").Delete On Error GoTo 0 Set cbMainMenuBar = _ Application.CommandBars("Worksheet Menu Bar") Set cbcCutomMenu = cbMainMenuBar.Controls.Add(Type:=msoControlPopup) cbcCutomMenu.Caption = "Process" cbcCutomMenu.OnAction = "unique_values_from_key_column" 'rename this to the macro that your are executing End Sub
Call the add_menu code when your workbook is opened.
![]()
Private Sub Workbook_Open() ADD_MENU End Sub
Bookmarks