Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Neil,
You have to loop through the contents of the list box's List to determine if the item already exists. E.g., Dim Ndx As Long Dim Found As Boolean With Me.ListBox1 For Ndx = 0 To .ListCount - 1 If .List(Ndx) = "whatever" Then Found = True Exit For End If Next Ndx If Found = False Then .AddItem "whatever" End If End With -- Cordially, Chip Pearson Microsoft MVP - Excel Pearson Software Consulting, LLC www.cpearson.com "Neil" wrote in message ... Hi, as part of my sheet upon a given event I add an item to a list box, but in some cases I can get the same item added twice. I want to check the listbox forst to see if a piece of text alreay exists on the list box, how do I go about this ? Many thanks in advance |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Array to Populate ListBox Problem | Excel Discussion (Misc queries) | |||
populating multicolumn listbox with an array instead of... | Excel Programming | |||
listbox.value not equal to listbox.list(listbox.listindex,0) | Excel Programming | |||
Is refreshing listbox rowsource in listbox click event possible? | Excel Programming | |||
Listbox and Array questions | Excel Programming |