Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 5 of 5

Thread: Combo Box

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I have a combo box on a form that looks up values from a sheet. What I need to setup is a label that when the user selects an entry from the combo box a corresponding cell entry is placed in the label. i.e. if the user selects the first name which originates in cell A1 on sheet 'client details' then the contents of cell B1 from 'client details' would be returned to the label.
    I know how to get the label to look up details from a sheet but I don't know how to make it dependent on a combo box entry or if it is possible.

    Thanks in advance

  2. #2
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-05-07 01:55, Phil C wrote:
    I have a combo box on a form that looks up values from a sheet. What I need to setup is a label that when the user selects an entry from the combo box a corresponding cell entry is placed in the label. i.e. if the user selects the first name which originates in cell A1 on sheet 'client details' then the contents of cell B1 from 'client details' would be returned to the label.
    I know how to get the label to look up details from a sheet but I don't know how to make it dependent on a combo box entry or if it is possible.

    Thanks in advance
    One way to do this given your info
    ie. A1 start B1 details and label = Label1
    is;

    Private Sub ComboBox1_Change()
    Label1.Caption = Cells(ComboBox1.ListIndex + 1, 2)
    End Sub

    Kind Regards,
    Ivan F Moala From the City of Sails

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks Ivan
    Your code worked but how do I get it to take the values from the "Client Details" Sheet?

  4. #4
    MrExcel MVP Ivan F Moala's Avatar
    Join Date
    Feb 2002
    Location
    Auckland, New Zealand
    Posts
    4,209
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default


    Private Sub ComboBox1_Change()
    Label1.Caption = Sheets("Client Details").Cells(ComboBox1.ListIndex + 1, 2)
    End Sub


    Kind Regards,
    Ivan F Moala From the City of Sails

  5. #5
    Board Regular
    Join Date
    Apr 2002
    Location
    NSW. Australia
    Posts
    64
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Thanks again Ivan. Greatly appreciated.

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

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