Duplicate numbers in a listbox

MJW

New Member
Joined
Feb 3, 2004
Messages
2
Hi everyone,

I have a combobox filled with numbers, some of which appear several times, but i would like each number only to appear on the list once. This list will also increase as i add new entries.

Is it possible to add items to this list once rather than have duplicate entires?

Thanks in advance for any help!
 

Excel Facts

Excel Can Read to You
Customize Quick Access Toolbar. From All Commands, add Speak Cells or Speak Cells on Enter to QAT. Select cells. Press Speak Cells.
Are the values in your list built from a Range of values, or are they stored elsewhere (i.e. in code, file, or database)?
 
Upvote 0
I don't know that a function exists to do this for you. You can certainly do a brute-force item-by-item check. That is:

Take item in list
Delete all subsequent occurrences of that item
Repeat until end of list encountered

HTH

Alan
 
Upvote 0
Can you post the code you use to add items to this list (range)?

Not quite sure what you're asking. If the data is in a spreadsheet you bind the list to the cells using something like:
UserForm1.ListBox1.RowSource =
#VALUE!
 
Upvote 0
Well, seeing as the items need to be added to the range in some way (either manually or via code), this is probably the best place to check for duplicates. :devilish:
 
Upvote 0

Forum statistics

Threads
1,214,652
Messages
6,120,746
Members
448,989
Latest member
mariah3

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