Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default population list box without repeating information

See one method at John Walkenbach's site:

http://www.j-walk.com/ss/excel/tips/tip47.htm
Filling a ListBox With Unique Items
--
Regards,
Tom Ogilvy

"medicenpringles"
<medicenpringles.1xdw6d_1130119510.7987@excelfor um-nospam.com wrote in
message news:medicenpringles.1xdw6d_1130119510.7987@excelf orum-nospam.com...

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



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Userform list box population Alberto Ast[_2_] Excel Discussion (Misc queries) 3 November 21st 09 01:14 AM
Repeating information throughout a worksheet kimmie Excel Discussion (Misc queries) 4 September 9th 08 11:33 PM
How to convert a repeating row of information to fit in 3 columns dawn Excel Worksheet Functions 3 May 21st 06 08:17 PM
How to convert a repeating row of information to fit in 3 columns dawn Excel Worksheet Functions 1 May 18th 06 03:35 AM
Extrapulating Information on current population from a worksheet KPM[_2_] Excel Programming 0 November 20th 03 09:36 PM


All times are GMT +1. The time now is 08:37 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"