Multiple macro button

Closed
Raj - Jul 12, 2010 at 08:41 AM
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
- Jul 18, 2010 at 08:52 AM
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

rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
Jul 13, 2010 at 08:01 AM
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
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
0
rizvisa1
Posts
4479
Registration date
Thursday January 28, 2010
Status
Contributor
Last seen
May 5, 2022
770
Jul 18, 2010 at 08:52 AM
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.
0