Listbox item selection Object required error

lynxbci

Board Regular
Joined
Sep 22, 2004
Messages
201
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
Hi,
I have got:
A listbox (populated from a data range) called productlist

You select an item from the list box and then hit a button
I want to carry out a function based on the chosen item.

When i click the the button i get object required error.
If i 'stop' the code and try to get productlist.text or productlist.selecteditem etc in the immediate window, i get object required error.
Where am i going wrong?

thanks
Kev
 

Excel Facts

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

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,343
Office Version
  1. 365
Platform
  1. Windows
Kev

How and where did you create the listbox?

By the way the Selected property for a listbox is only really used when it's multi-select.
 

lynxbci

Board Regular
Joined
Sep 22, 2004
Messages
201
Office Version
  1. 365
Platform
  1. Windows
  2. MacOS
I Created it at design stage using the list icon (from the forms toolbar) and then control tab and selecting a data range as the control, the data range changes according to other criteria.

I would like to eb able to select multiple items but one thing at a time.

thanks
 

Norie

Well-known Member
Joined
Apr 28, 2004
Messages
76,343
Office Version
  1. 365
Platform
  1. Windows
So it's a listbox on a worksheet created from the Forms control toolbox?

It can be difficult to work with that sort of control using code.

Have you considered using the linked cell property?

Whatever is selected will be reflected there and you could perhaps use it for your function.

Mind you the value in the linked cell won't actually be the value selected from the list - it will be the index of the selected item.
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,163,425
Messages
5,831,559
Members
430,075
Latest member
Tuturino

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