Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I am running a macro that looks at column "a" and populates the cells value in a combo box using additem. My problem is that if there are duplicates or blank cells i dont want them populated in the combo box. Pleae help Thanx |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi David
Read this example for a listbox http://www.j-walk.com/ss/excel/tips/tip47.htm -- Regards Ron de Bruin http://www.rondebruin.nl "David" wrote in message k... Hi I am running a macro that looks at column "a" and populates the cells value in a combo box using additem. My problem is that if there are duplicates or blank cells i dont want them populated in the combo box. Pleae help Thanx |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Try this:
Try this: 'Assuming your value to add to the combo is in cell A1 Sub Sample() 'If Cell A1 is empty, forget it. If Len(ActiveSheet.Range("A1").Value) = 0 Then Exit Sub For Each Item In ComboBox1.List 'If the value already exists, forget it.... If trim(ActiveSheet.Range("A1").Value) = trim (Item) Then i = 1 Exit For End If Next Item If i = 1 Then Exit Sub Else '....otherwise add it ComboBox1.AddItem (ActiveSheet.Range("A1").Value) End If End Sub -----Original Message----- Hi I am running a macro that looks at column "a" and populates the cells value in a combo box using additem. My problem is that if there are duplicates or blank cells i dont want them populated in the combo box. Pleae help Thanx . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
linking a form combo box... results from the combo box to another | Excel Discussion (Misc queries) | |||
combo reference on another combo box for picking address etc. | Excel Worksheet Functions | |||
In Excel I need to set up a combo box based on another combo box. | Excel Discussion (Misc queries) | |||
"Combo Box - getting control combo box to stick in place in worksh | Excel Discussion (Misc queries) | |||
"Combo Box - getting control combo box to stick in place in worksh | Excel Discussion (Misc queries) |