Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
i have a list in my spreadsheet which needs to be added to my combo box
list. The problem is that there are repeated number of these values. This is the code I have written but it does not work as i need it to. Not all the values have been added into the list. Also for every letter i type in the combo box this function is called making it slow. If some1 could correct it, it would be great. Thanks! Private Sub ComboBox1_Change() Dim i As Integer Dim j As Integer Dim count As Integer Dim entry As String Dim check As String Range("C8",Range("C8").End(xlDown)).Select count = Selection.Rows.count Worksheets("Portfolio").Range("DR11")=count For i = 8 To count entry = Cells(i, 3).Value ComboBox1.AddItem (entry) Next i For i = 8 To count entry = Cells(i, 3).Value For j = i + 1 To count check = Cells(j, 3).Value If entry = check Then ComboBox1.RemoveItem (j) End If Next j Next i End Sub It would be great too if some1 cud show me how to sort the list. |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See John Walkenbach's article. He uses a listbox, but it is the same for a
combobox. http://j-walk.com/ss/excel/tips/tip47.htm However, I wouldn't use the change event. Perhaps the dropdown event. Or if the data is static, the worksheet activate event. -- Regards, Tom Ogilvy "Abhay Sanan" wrote in message ... i have a list in my spreadsheet which needs to be added to my combo box list. The problem is that there are repeated number of these values. This is the code I have written but it does not work as i need it to. Not all the values have been added into the list. Also for every letter i type in the combo box this function is called making it slow. If some1 could correct it, it would be great. Thanks! Private Sub ComboBox1_Change() Dim i As Integer Dim j As Integer Dim count As Integer Dim entry As String Dim check As String Range("C8",Range("C8").End(xlDown)).Select count = Selection.Rows.count Worksheets("Portfolio").Range("DR11")=count For i = 8 To count entry = Cells(i, 3).Value ComboBox1.AddItem (entry) Next i For i = 8 To count entry = Cells(i, 3).Value For j = i + 1 To count check = Cells(j, 3).Value If entry = check Then ComboBox1.RemoveItem (j) End If Next j Next i End Sub It would be great too if some1 cud show me how to sort the list. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Removing Duplicates Help | Excel Discussion (Misc queries) | |||
Removing Duplicates | Excel Worksheet Functions | |||
removing duplicates | Excel Discussion (Misc queries) | |||
Removing Duplicates | Excel Discussion (Misc queries) | |||
removing duplicates | Excel Programming |