Can anyone please help with a listbox which contains the values/text of cells A1:B10 and then if any rows in the listbox equals Hello or 1234 it would then run macro named Macro3. Thanks
Mike has given you the solution to run macros by name. If you want to use "alternative names" then just adapt it for whatever selections (values) you would like to see in the listbox:
Note:
A very simple approach would be:
1) Load the listbox with values
2) Use a Select Structure:
Code:
Select Case Listbox1.Value
Case "Hello" or "1234"
Application.Run "Macro3"
End Select
If you use a Forms Listbox then you'll probably need to run this code on a change event in the linked cell that is hooked up to the listbox (these are easier to set up and look better so I would go with the forms listboxes).
You can also run macros from the macro dialog box.
If you use a Forms listbox it's as easy as setting the link range. But since you are using two columns, you'll be best of creating a "third" range where all 20 cells are in order top to bottom (simple formulas will populate this from A1:B10).
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.