Listbox Values From Cells

Jaye7

Well-known Member
Joined
Jul 7, 2010
Messages
1,060
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
 

Excel Facts

Return population for a City
If you have a list of cities in A2:A100, use Data, Geography. Then =A2.Population and copy down.
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:

http://www.mrexcel.com/forum/showthread.php?t=484232

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.
 
Last edited:
Upvote 0
Thanks Xenou,

I will incorporate Mike's example, however, can you please provide a vba script that will put the contents of cells i.e. A1:B10 in the listbox
 
Upvote 0
Upvote 0

Forum statistics

Threads
1,214,394
Messages
6,119,263
Members
448,881
Latest member
Faxgirl

We've detected that you are using an adblocker.

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.
Go back
Back
Top