+ Reply to Thread
Results 1 to 12 of 12

Userform's listbox values depending on values on certain matrix

  1. #1
    Registered User
    Join Date
    10-17-2007
    Posts
    62

    Userform's listbox values depending on values on certain matrix

    Hi all,

    I have problems with my userform's listboxes. I have two listboxes, and I want second listbox's values to be dependent on first listbox's values.

    And even more complicated, I need second listbox's values to be dependent on values on certain matrix.

    In that matrix, row headings are listbox1's values and column headings are listbox2's values. How ever there are blanc cells on that matrix aswell. So if there is a blanc cell(s) on a row which (heading) is selected at listbox1, then I don't want that column (heading) which intersects with the blanc cell to be included to my listbox2 values.

    Finally I want to insert the selected values from listboxes and the value from the intersection of those listbox values (headings) on that matrix to worksheet.

    I included an attachment, where you can see my point better. However, as you can see, now the listbox values are not dependent on that matrix. Otherwise it is working like I want it to work.

    -Juhanen-
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Hi,

    I hope someone can help with my question, because I'm still stuck on it.

    Thanks

    -juhanen-

  3. #3
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Bump no response
    Last edited by Juhanen II; 08-18-2008 at 03:11 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    What exactly do you want to display in ListBox2? Say Wed is chosen in ListBox1 do you want ListBox2 to contain 5,7,11 or w2,w3,w4?
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Hi Roy,

    Sorry if I failed to be spesific...

    For example if Wed is chosen in Listbox1 , then I want ListBox2 to contain w2,w3,w4

    Thanks,
    -Juhanen-

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Remove the RowSource of ListBox2 in the Properties. Then use the Click event of ListBox1


    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Thanks Roy. However, there's a mistake in the code:

    For example if Wed is chosen in Listbox1 , instead of w2,w3,w4 ListBox2contains w5, w7, w11. (So instead of headings of the matrix, "w"+nonblanc values of the specified row are selected to Listbox2)

    Secondly, I would be thankful if the code would use range names when referring to ranges, so that I could use the same code in different matrixes.

    -Juhanen-

  8. #8
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    bump no response

  9. #9
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    Quote Originally Posted by Juhanen II View Post
    Thanks Roy. However, there's a mistake in the code:

    For example if Wed is chosen in Listbox1 , instead of w2,w3,w4 ListBox2contains w5, w7, w11. (So instead of headings of the matrix, "w"+nonblanc values of the specified row are selected to Listbox2)
    There's no mistake in the code, it does exactly what I thought that you wanted. However, I think you want the header row so I have changed the code

    Please Login or Register  to view this content.
    Secondly, I would be thankful if the code would use range names when referring to ranges, so that I could use the same code in different matrixes.

    -Juhanen-
    You will need to adapt the code to suit whatever ranges you want to use

  10. #10
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Thanks,

    However, the new code doesn't work. (There is no error message, but second listbox is fully empty no matter which value you select form listbox1)

    -Juhanen-

  11. #11
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200
    It works fine in the example workbook that you uploaded.


    Try this slight amendment
    Please Login or Register  to view this content.
    Last edited by royUK; 08-19-2008 at 07:42 AM.

  12. #12
    Registered User
    Join Date
    10-17-2007
    Posts
    62
    Thanks RoyUK

    Now it works well. U saved my day.

    -Juhanen-

+ 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