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
 

Some videos you may like

Excel Facts

Excel Wisdom
Using a mouse in Excel is the work equivalent of wearing a lanyard when you first get to college

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,796
Office Version
  1. 2019
Platform
  1. Windows
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:

Jaye7

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

xenou

MrExcel MVP
Joined
Mar 2, 2007
Messages
16,796
Office Version
  1. 2019
Platform
  1. Windows

Watch MrExcel Video

Forum statistics

Threads
1,123,337
Messages
5,601,026
Members
414,422
Latest member
acegreen

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
Top