Consulting

Results 1 to 10 of 10

Thread: Solved: list and combo box

  1. #1

    Solved: list and combo box

    Hi all. I hope you can help me on this. I have a list box with names (each name i repeated several times). I want to conbine this list box with a combo box so when I select a name in the combo box all same names in the list box are selected. Any help on this?

  2. #2
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Joanna,
    Welcome to VBAX

    Have a look at the attached example
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  3. #3
    works great. many many thanks!!!!

  4. #4
    well, here I am again. As far as I'm running your example I get the results I want. If I try to build my own form then I get the following message "Run-time error 70, Permission Denied". Any idea what might goes wrong?

  5. #5
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Check that your listbox is set to Multiselect in the properties window.
    What line of code is highlighted when this error occurs?
    Can you zip and post your document? Use Go Advance and Manage Attachments to do this.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  6. #6
    ok. here is my attempt.

  7. #7
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Joanna,
    I'm getting the same result. I'll investigate and get back to you.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  8. #8
    ok thanks. please note that I need to show 2 columns in the list cause one holds names and the other holds surnames. If this is possible.

  9. #9
    Administrator
    VP-Knowledge Base VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Hi Joanna,
    The problem was cause by the setting of the list and combo box by both an Initialize sub and the rowsource property. Delete either and the form works fine. I've amended your code to delete the initialize macro.
    Regarding the two names, I've added this to the sample. The listbox has to be set to two columns and the column containing the main data is set as the "Bound" column.
    I've called the Names columns MyNames and set the RowSource accordingly.
    If this requires to be dynamic, this can be set by your code when the workbook opens.
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  10. #10
    Well it seems that works now. I'll try it further. I need something else thought to complete my work. As you noticed i added some code to show the contents of the list box on the sheet. Is it possible to show both columns? This is important as I have to show the names/surnames and help a vlookup formula on the sheet to locate the other columns beside. Well I'm sure you can do another one miracle!

Posting Permissions

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