Multiple macro button

[Closed]
Report
-
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
-
Hello,
In my excel i have 5 macros performing different task eg:- hide sheet, sort rows, etc. I have added 5 different buttons in my excel assigning each macro to one button.

Problem:- due to this my excel looks over crowded. I want to add one drop down button which can hold all the macro buttons.

Can some one please help me ASAP:)

Regards

Raj

1 reply

Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Add a drop down
add names of all macros to the list

define change event for the drop down and fire the macro that was selected


Private Sub Combo1_Change()

    Select Case Combo1
    
    Case Is = ""
    ' no action
    
    Case Is = "Macro1"
        Call Macro1
        
    Case Is = "Macro2"
        Call Macro2
        
    Case Is = "Macro3"
        Call Macro3
    
    
    Case Else
        MsgBox "undefined macro"
        
    End Select
    
End Sub
1
Thank you

A few words of thanks would be greatly appreciated. Add comment

CCM 2821 users have said thank you to us this month

Hey Thanks Riz,

if it is not too much a trouble can you tell me how to do it step by step with print screen if possible.

1. I am trying to add drop down button in excel in formatting bar. but I can one button to it eg :- 'smiley image'.
2. Do i need to add the macro you have mentioned in the VBA editor and assign it to some thing?

If you can help me step by step it would be really great...

Regards

Raj
Posts
4476
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
August 2, 2020
768
Sorry for delay. Life has been too busy lately.

Do you have to use the sheet for drop down or can you use a form too for a the dropdown.
In case you use form, than form would have the dropdown, user will make a selection, and macro will run
In case of sheet it will be same idea, how ever, in case of sheet, it has to be attached to a cell. May be it is lack of my experience using dropdowns on sheet, I tend to prefer form.

For #2, the answer is yes. This code needs to go in VBE.