How to run code based on a dropdown form changing?

P

PropKid

I've used the validation dropdowns before but prefer the VBA for
because it automatically has the down arrow next it. The validatio
dropdown only shows an arrow when it is selected.

I would like to run some code based on the selection chosen in th
dropdown form (which is inserted into the spreadsheet) when th
selection is changed.

Any assistance would be greatly appreciated
 
M

Mike Fogleman

Use the ListIndex value of the ListBox. eg if there are four items in your
list, then they have a list index number that starts with 0:
0, 1, 2, 3. The code would look like this:

If ListBox1.ListIndex = 0 Then macro_name1
If ListBox1.ListIndex = 1 Then macro_name2
'etc for each item you want to run a macro
Mike F
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top