• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

need to call a macro from Combobox and run that macro

sreenivas

New Member
hi,


i have a userform (alt+f11 --> insert--> userform) and a COMBOBOX (with options 1.macro1

2. macro2 , 3. macro3...) if i select macro1 and click on run it has to call the macro1 and run the code for that. This has to be done using Userform in VBA not on the excel sheet. please could you help me with this?
 
in the code for your command button click:


if me.combobox1.value = "macro1" then


call macro 1


else


if me.combobox1.value = "macro2" then


call macro 2


etc

etc
 
hi Dave,


thanks for the post, i want to know where to initialize the macro1, macro2,... ?

Should i initialize in the excel sheet or the userform's combobox?
 
if you have a commandbutton on your form, double click it and write your code there. It will then run when the command button is clicked.


If you post an example workbook I can show you
 
Back
Top