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

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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.
 
Upvote 0
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
 
Upvote 0
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.
 
Upvote 0

Forum statistics

Threads
1,214,945
Messages
6,122,395
Members
449,081
Latest member
JAMES KECULAH

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