View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
medicenpringles[_25_] medicenpringles[_25_] is offline
external usenet poster
 
Posts: 1
Default population list box without repeating information


ok, so i used the code below to fill a list box:


Code:
--------------------
Private Sub UserForm_Initialize()

Dim oIngredient As Ingredient
Dim oIngredients As New Ingredients
Dim avIngredients() As Variant
Dim i As Integer

For i = 1 To oIngredients.Count
Set oIngredient = oIngredients.Item(i)
avIngredients(i) = oIngredient.IngredientType
If oIngredient.Type = previoustype Then ' need something here
GoTo Skip
Else
Me.lstPreDefinedTypes.AddItem (CStr(oIngredient.IngredientType))
End If
Skip:
Next i

End Sub
--------------------


well, not exactly; the "oIngredient.Type = previoustype" needs to be
replaced with something that will look through the array being filled
and return true if it finds a duplicate.
is there a way to do this?

thanks ahead of time,
sven


--
medicenpringles


------------------------------------------------------------------------
medicenpringles's Profile: http://www.excelforum.com/member.php...o&userid=16458
View this thread: http://www.excelforum.com/showthread...hreadid=478659