Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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
Posted to microsoft.public.excel.programming
|
|||
|
|||
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 |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
how to get Excel 07 combobox to populate from MS Access table? | Excel Discussion (Misc queries) | |||
How do i populate a text box according to selection in combobox? | Excel Worksheet Functions | |||
Populate Column Header on ComboBox | Excel Programming | |||
Populate combobox with visable rows only | Excel Programming | |||
Having data populate text boxes based on Combobox Value | Excel Programming |