+ Reply to Thread
Results 1 to 13 of 13

listbox question

  1. #1
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    listbox question

    Hey,

    I have a couple of listboxes. How can I add number format to iteams in those listboxes. For example -

    1. Coffee
    2.Sugar
    3. Milk
    etc.

    I want to do it, since I would like to compare some information from theese listboxes and match the values I need to the corresponding items.

    Thank you.

    Or the other option which is better..can I do it somehow when I click on certain value in listbox1 I want my userform to select the corresponding value in order from listbox2 etc. Probably this is too difficult, but still. Thank you

  2. #2
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    Do you mean you want to add 1,2,3 etc in front of each item in the listbox?

    That should be straightforward but I don't see how it would help matching values.

    What is it you are matching against?

    Is it the values in the second listbox? Are they the same, and in the same order, as those in the first listbox?
    If posting code please use code tags, see here.

  3. #3
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    Yep. The values in the first listbox1 have the same order as the values in listbox2. So if I add 1,2,3 in front of the items in the listboxes then I would be able to see for example 3 from listbox1 corresponds to 3 from listbox2 and thus compare the values. This would be perfect unless the second option with clicking is not possible. I mean when I click on say the 4th item from listbox1 then I want the 4th item from listbox2 to be selected as well.

  4. #4
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    If you want the value clicked in the first listbox to be selected in the second.
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    Nope. It doesn seem to work. When I click on the value in the first listbox1 the value on the same row from listbox2 is not selected.

  6. #6
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    Where did you put the code?

  7. #7
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    I ve put it on a mouse click event in listbox1. However, oddly enough, I dont know why there is a slight mismatch. It matches the values with 1-2 items difference although without this event everything matches perfectly. I dont know why.

    Can you tell me how I can add numering in front of the idems - 1,2,3,4 etc.? Thanks

  8. #8
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    Is it possible to connect somehow the values from the excel sheet directly in the listboxes?

  9. #9
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    I don't see how numbering will help with matching.

    The code I posted uses the ListIndex property of the first listbox (ListBox1) to set the ListIndex property of the second listbox (ListBox2).

    The ListIndex is used to indicate/set which item is selected in a listbox.

    The code should be in the click event of the first listbox.

    Can you attach a sample workbook?

  10. #10
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    Ok..lets do it the other way. Can I synchronize the pace of scrolling down. When I scroll down twice listbox1 then I want also two times scroll down for listbox2? Thanks

  11. #11
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    What exactly are you trying to do?

  12. #12
    Registered User
    Join Date
    01-26-2013
    Location
    UK
    MS-Off Ver
    Excel 2010
    Posts
    29

    Re: listbox question

    When I scroll down the first listbox1 then I want listbox2 to be automatically scrolled down the same paces.

    For ex. If I scroll down twice listbox1 then I want two times scroll down for listbox2 too

  13. #13
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,644

    Re: listbox question

    To do that would involve the code I've already posted, which you say doesn't work.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1