Results 1 to 6 of 6

Thread: ComboBox (XP)

  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ComboBox (XP)

    I have created a combobox from the Control Toolbox and have linked to a cell. The linked cell displays the text selected but can it return the position such as the second selection or #2?

    Thanks,
    John

  2. #2
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox (XP)

    Thanks Steve it worked perfectly.

    John

  3. #3
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: ComboBox (XP)

    <P ID="edit" class=small>(Edited by sdckapr on 02-Apr-04 18:38. Corrected error)</P>Change the "BoundColumn" property to zero (0).

    Be aware that the listing is "zero-based". The first selected = 0, the 2nd = 1, so if you use it with INDEX (eg) you must add 1 to it.

    The ComboBox in FORMS toolbar has its cell link "linked" to the "1-based" index value.

    Steve

  4. #4
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox (XP)

    One interesting note: upon opening the workbook, the combobox resets itself or said another way nothing in the ListFillRange The linked cell is either a 0, 1, 2 and etc...

    If I change the linked cell of the combobox the appropriate text is displayed. Do you think this has to do with the focus?

    I have attached a sample file.

    Thanks,
    John

  5. #5
    WS Lounge VIP sdckapr's Avatar
    Join Date
    Jul 2002
    Location
    Pittsburgh, Pennsylvania, USA
    Posts
    11,225
    Thanks
    14
    Thanked 342 Times in 335 Posts

    Re: ComboBox (XP)

    I think this is "by design" of this combobox.

    You can add code to the workbook open event to set the cell and it will be displayed:

    <pre>Private Sub Workbook_Open()
    With Worksheets("sheet1")
    .Range("a1").Value = .Range("a1").Value
    .Range("b1").Value = .Range("b1").Value
    .Range("c1").Value = .Range("c1").Value
    End With
    End Sub</pre>


    Another (non-macro solution) would be to use the combo from the Forms toolbar which are not reset (though you have less control over them)

    Steve

  6. #6
    5 Star Lounger jujuraf's Avatar
    Join Date
    Jun 2001
    Location
    San Jose, California, USA
    Posts
    1,061
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ComboBox (XP)

    I see you've got the answer to your problem, but you could also use the combo box from the Form controls as it doesn't have this restriction. I tried it on your workbook and it works just as you wanted the one on the Controls tool box to work (the selection stays, no bounds control setting needed)

    Deb

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •