PC Review


Reply
Thread Tools Rate Thread

combolist array.

 
 
=?Utf-8?B?U2pha2tpZQ==?=
Guest
Posts: n/a
 
      1st Mar 2007
IS there a way to create a combolist (vb) which adds everyone in column c and
only adds one instance of the name.

say

name1
name2
name3
name1
name1
name2
name4
name5

which turns into
name1
name2
name3
name4
name5
 
Reply With Quote
 
 
 
 
merjet
Guest
Posts: n/a
 
      1st Mar 2007
You didn't say if the ComboBox was on a UserForm or Worksheet, but the
coding would be similar. The following is for a UserForm.

Private Sub UserForm_Activate()
Dim iEnd As Long
Dim iRow As Long
Dim NoDupes As Collection
Dim ws As Worksheet

On Error Resume Next
Set ws = Worksheets("Sheet1")
iEnd = ws.Cells(65536, "C").End(xlUp).Row
Set NoDupes = New Collection
For iRow = 1 To iEnd
NoDupes.Add ws.Cells(iRow, "C"), ws.Cells(iRow, "C")
If Err.Number = 0 Then
ComboBox1.AddItem ws.Cells(iRow, "C")
Else
Err.Clear
End If
Next iRow
End Sub

Hth,
Merjet

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      1st Mar 2007
Dim iLastRow As Long
Dim aryData
Dim i As Long
Dim iItem As Long

With Worksheets("Sheet1")
iLastRow = .Cells(.Rows.Count, "C").End(xlUp).Row
ReDim aryData(1 To iLastRow)
For i = 1 To iLastRow
If IsError(Application.Match(.Cells(i, "C").Value, aryData, 0))
Then
iItem = iItem + 1
aryData(iItem) = .Cells(i, "C").Value
End If
Next i
ReDim Preserve aryData(1 To iItem)
Me.ComboBox1.List = aryData
End With


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Sjakkie" <(E-Mail Removed)> wrote in message
news:C33D72B3-4A2A-4A81-99B5-(E-Mail Removed)...
> IS there a way to create a combolist (vb) which adds everyone in column c
> and
> only adds one instance of the name.
>
> say
>
> name1
> name2
> name3
> name1
> name1
> name2
> name4
> name5
>
> which turns into
> name1
> name2
> name3
> name4
> name5



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Combolist to show checkboxes Robbie Doo Microsoft Access Reports 0 9th Jan 2008 07:19 AM
ComboList Source =?Utf-8?B?TWlrZSBILg==?= Microsoft Excel Programming 4 6th Aug 2007 07:41 PM
ComboList Query Search Funkydan Microsoft Access Forms 2 22nd Jan 2007 09:42 AM
Name Value pair in Combolist RSH Microsoft C# .NET 7 10th Jan 2006 10:55 PM
Available printers in a dropdown-combolist? NorTor Microsoft Excel Programming 2 7th Sep 2003 05:21 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 04:33 PM.