Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Help with combo box

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,123
Default Help with combo box

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   Report Post  
Posted to microsoft.public.excel.programming
tod tod is offline
external usenet poster
 
Posts: 114
Default Help with combo box

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
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
linking a form combo box... results from the combo box to another Trey Excel Discussion (Misc queries) 1 July 15th 07 01:58 AM
combo reference on another combo box for picking address etc. kbjin Excel Worksheet Functions 1 December 8th 06 03:29 PM
In Excel I need to set up a combo box based on another combo box. donna_ge Excel Discussion (Misc queries) 2 March 29th 06 03:26 PM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 1 February 16th 05 02:05 AM
"Combo Box - getting control combo box to stick in place in worksh ajr Excel Discussion (Misc queries) 0 February 15th 05 07:45 PM


All times are GMT +1. The time now is 02:44 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"