+ Reply to Thread
Results 1 to 16 of 16

Listbox Issues / Errors with UserForm

  1. #1
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Listbox Issues / Errors with UserForm

    I am having a few issues with a userform attached. I would first like to thank Roy UK for the link to the VB and website http://www.excel-it.com/vba_examples.htm this has helped me out no end but I have a few issues that I have tried to solve but have come up against walls all over the place.

    1. ListBox1 – if there is any more then 1 record found then I keep getting errors unless I have remove .TextBox10.Value = ListBox1.List(R, 9) upwards.

    Please Login or Register  to view this content.


    2. After removing .TextBox10.Value = ListBox1.List(R, 9) upwards I then get the following issues.
    a. It only deletes the record at the top of the list and not the one that is selected
    b. How to make the ListBox columns narrower.
    c. What code is needed to clear the ListBox.

    I would appreciate all the help that anyone can give me.
    Attached Files Attached Files
    Last edited by Chris270; 08-31-2011 at 02:05 PM. Reason: No response

  2. #2
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox issues

    Bump no response

  3. #3
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    Bump no response

  4. #4
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    Hi…. Can someone please help me please? I’m not sure if no one wants to help or no one has got around to looking at this yet?

  5. #5
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Listbox Issues / Errors with UserForm

    Hi

    You've hit upon one of the limitations of the listbox - using the addItem method, you can't add more than 10 columns so you need to fill using something like the below:

    Please Login or Register  to view this content.

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listbox Issues / Errors with UserForm

    Hi Chris270

    This is my first attempt at using ListView Controls so we may struggle with this approach. I was introduced to ListView by Leith Ross in a Thread I was following.

    The attached has the ListView Control in place of the ListBox Control. Play with it...let me know issues...perhaps this'll work for you.
    Attached Files Attached Files
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  7. #7
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    Sorry for not posting for a while but I have been out of the country for a bit. (no regular internet connections) All attachments have disappeared and now I am lost.

    Kyle123
    Where would you suggest this is placed?

    jaslake
    Could you post the attachment again so I can have a look.

    I have attached the file with some changes but I am still having issues with the following in the userform
    - Can’t add more than 10 columns
    - Can’t delete the selected row in the listbox, it only deletes the first row in the list box.
    Can anyone help please?

    DataBaseForm.xls

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listbox Issues / Errors with UserForm

    Hi Chris270
    It'll be a bit before I get back to you...with Forum issues and the Holidays. I WILL get back to you.

  9. #9
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Listbox Issues / Errors with UserForm

    Hi Chris
    I've attached a file that I presume is the one referred to.
    Attached Files Attached Files

  10. #10
    Forum Guru Kyle123's Avatar
    Join Date
    03-10-2010
    Location
    Leeds
    MS-Off Ver
    365 Win 11
    Posts
    7,238

    Re: Listbox Issues / Errors with UserForm

    You would place my code wherever you are running the search from, it means that you don't have to use a listview, which are the easiest things in the world to pick up and use.

    @Jaslake, I'm a big fan of ListView, it does sorting and all kinds of wonderful stuff - good idea

  11. #11
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    John, Kyle123

    Many thanks I will take a look and get back to you. Have a great Christmas and an even better New Year.
    Thanks to all in advance for your help

    Chris

  12. #12
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Listbox Issues / Errors with UserForm

    In this case I would copy & paste the found items to temporary sheet then use the new list as the RowSource for the ListBox
    Hope that helps.

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

    Free DataBaseForm example

  13. #13
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: Listbox Issues / Errors with UserForm

    Replace the FindAll Procedure with this
    Please Login or Register  to view this content.

  14. #14
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    Roy UK,

    Thanks for your assistance i have added the code and removed the old code, however I am getting the following issue:

    Run-time error “Could not set the RowSource property. Member not found.”

  15. #15
    Registered User
    Join Date
    07-06-2011
    Location
    Germany
    MS-Off Ver
    Excel 03,07 & 2010
    Posts
    28

    Re: Listbox Issues / Errors with UserForm

    jaslake,

    I am still having issues with the following:
    - Saving changed data (it saves it in the top listed person and not the one selected)
    - Deleting data (it deletes the top listed person and not the one selected)

  16. #16
    Forum Expert snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,649

    Re: Listbox Issues / Errors with UserForm

    Please start at the beginning:

    Please Login or Register  to view this content.
    und dann:

    Please Login or Register  to view this content.
    Last edited by snb; 01-04-2012 at 07:25 AM.



+ 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