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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Combo box how to

Status
Not open for further replies.

paulmtl

Programmer
Feb 25, 2005
27
CA
Hi all,

How to use combo box in the Excel workboot ?

empno:
11111
22222
33333
44444

in order to select empno from combo box

Thanks in advance
 

Hi,

In what application?

Skip,
[sub]
[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue][/sub]
 

In Excel there are 2 kinds of controls that you can place on a worksheet: Forms & Control Toolbox.

Forms controls are easier to use but have fewer properties that you can comtrol -- easier to use because you may not need any code to do what you want to do.

Control Toolbox controls need VB code for any event.

Right click on the Excel toolbar and select either Forms or Control Toolbox.

Both controls will take a range in
[tt]
Input Range
ListFillRange
[/tt]
I like to use Named Ranges -- How can I rename a table as it changes size faq68-1331

There is a difference in determining the result.

In a Forms combo, you get the List Index value in the Linked Cell. You'll need to lookup the string value using =INDEX(YourList,LinkedCell,1)

In the Control Toolbox combo, the Combobox1_Click event can be used to determine the value selected
Code:
Private Sub ComboBox1_Click()
   msgBox ComboBox1.Value
End Sub



Skip,
[sub]
[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue][/sub]
 
Hi Skip,

Perfect to built combo box, I can select 11111 from combo box and how to past that to the new cell ?

TIA
 
Code:
Private Sub ComboBox1_Click()
  With ActiveSheet
    .[A1].Value = .ComboBox1.Value
    .Cells(1, 1).Value = .ComboBox1.Value
    .Cells(1, "A").Value = .ComboBox1.Value
  End With
End Sub
all statements do the same thing

Skip,
[sub]
[glasses] [red]Be advised:[/red]When Viscounts were guillotined just as they were disclosing where their jewels were hidden, it shows to go that you should...
Never hatchet your Counts before they chicken! [tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top