Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add items to a combo box

Status
Not open for further replies.

funkmonsteruk

IS-IT--Management
Feb 8, 2002
210
GB
Hi, using my first combobox in excell and having a few problems.

I want the combobox to list e-mail addresses (either by the name of the person or their full address) and i need the user to be able to select a value from the combo box.

I need to be able to do two things: Firstly how do i add items to the combobox in the firat place (basic i know but this is my first attempt with a combo box)

Secondly how do i reference the selected e-mail address for my vba routine i'm guessing it'll be along the lines of ComboBox1.Value, but couldn't be sure....

If anyone con help would be grately appreciated

Funkmonsteruk
 
For 1:
ComboName.clear
For Each c in range("A1:A25")
comboname.Add(c)
next

This is dependant on you having a list to iterate thru. If the list will never change, then just set the SOURCEdata to your list.

To reference the selection in the combobox, use
ComboName.Text

This is based on teh combobox being on a form - the syntax for a worksheet based combobox is slightly different





Rgds
~Geoff~
 
Hi,

It's actually on a worksheet, how would this affect the code...

Funkmonster
 
You need to use Sheets("Sheetname").shapes("ComboboxName").
etc etc Rgds
~Geoff~
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top