Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Populate a combobox

I currently have combobox1 that looks to a hidden sheet
and uses the first column (name) to populate (removing
duplicate occurences of the name). What I need to do now
is populate combobox2 based on the combobox1, that pulls
data from the second column of the hidden sheet, but only
those where column 1 equals combobox 1.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Populate a combobox

Why not fill them at the same time.

Combobox1.AddItem Cells(rw,1)
Combobox2.AddItem cells(rw,2)

--
Regards,
Tom Ogilvy

"Rory" wrote in message
...
I currently have combobox1 that looks to a hidden sheet
and uses the first column (name) to populate (removing
duplicate occurences of the name). What I need to do now
is populate combobox2 based on the combobox1, that pulls
data from the second column of the hidden sheet, but only
those where column 1 equals combobox 1.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default Populate a combobox

Here's the code as it stands, the range "client" being the
first column of names, tried as you suggested but I think
that beacause the original range is only the first column
this wouldn't work, also when it screens out duplicates
all will be unique due to the second column??:

Private Sub Worksheet_Activate()
Dim AllCells As Range, cell As Range
Dim NoDupes As New Collection
Dim i As Integer, j As Integer
Dim Swap1, Swap2, item




Set AllCells = Worksheets("Client").Range("client")

Worksheets("sheet1").Select

ComboBox5.Clear
ComboBox4.Clear


On Error Resume Next
For Each cell In AllCells
NoDupes.Add cell.Value, CStr(cell.Value)

Next cell


On Error GoTo 0


For i = 1 To NoDupes.Count - 1
For j = i + 1 To NoDupes.Count
If NoDupes(i) NoDupes(j) Then
Swap1 = NoDupes(i)
Swap2 = NoDupes(j)
NoDupes.Add Swap1, befo=j
NoDupes.Add Swap2, befo=i
NoDupes.Remove i + 1
NoDupes.Remove j + 1
End If
Next j
Next i


For Each item In NoDupes

ComboBox5.AddItem item

Next item
End Sub
-----Original Message-----
Why not fill them at the same time.

Combobox1.AddItem Cells(rw,1)
Combobox2.AddItem cells(rw,2)

--
Regards,
Tom Ogilvy

"Rory" wrote in message
...
I currently have combobox1 that looks to a hidden sheet
and uses the first column (name) to populate (removing
duplicate occurences of the name). What I need to do now
is populate combobox2 based on the combobox1, that pulls
data from the second column of the hidden sheet, but

only
those where column 1 equals combobox 1.



.

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
how to get Excel 07 combobox to populate from MS Access table? xz Excel Discussion (Misc queries) 0 November 20th 07 05:45 PM
How do i populate a text box according to selection in combobox? Steve Excel Worksheet Functions 0 April 13th 06 12:40 PM
Populate Column Header on ComboBox michael_13143 Excel Programming 1 April 23rd 04 05:45 PM
Populate combobox with visable rows only max Excel Programming 1 February 17th 04 02:27 AM
Having data populate text boxes based on Combobox Value Todd Huttenstine[_2_] Excel Programming 1 November 10th 03 01:35 AM


All times are GMT +1. The time now is 06:49 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"