+ Reply to Thread
Results 1 to 13 of 13

Delete an entry (row) in a userform listbox and update table on worksheet

  1. #1
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Delete an entry (row) in a userform listbox and update table on worksheet

    Hi,

    I have a Userform with a listbox which is populated with the data in a table (Table1).

    I want to be able to select multiple rows on the userform listbox and click a delete button which deletes the rows from both the userform listbox and the table on my worksheet.

    I have a code which works but only for a single row deleted at a time.

    Also I have 5 listboxes on the userform all populated with tables (tables1-5). When I delete rows on the userform the listboxes are no longer correctly populated as rows have been deleted.

    Hope this makes sense and I would appreciate any help on this.

    Thanks

    Please Login or Register  to view this content.
    Last edited by colin7; 08-07-2019 at 04:49 PM.

  2. #2
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    Does anyone have a solution for this?

  3. #3
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    How do you populate the listbox list? using Rowsource? or directly from the table range?, something like like this:
    Please Login or Register  to view this content.

  4. #4
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    I use rowsource.

  5. #5
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    listbox1 is populated with table1 and listbox2 is populated with table2. When I delete several rows from listbox1 it seems to shift all the rows up on listbox2

  6. #6
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    On my actual worksheet named "Tenders", my tables are in the same columns and placed beneath one another

  7. #7
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    I find using Rowsource unreliable if you plan to add or delete the list item (well, maybe I did it wrong).
    So here's an example what I would do without using Rowsource:

    Please Login or Register  to view this content.
    Can you attach your sample workbook?

    The sample workbook:

  8. #8
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    Thanks so much for your help, your code works perfectly. Would it be ok if I send you my userform to look at? I need help with some other codes for it as I am not very good with VBA?

  9. #9
    Valued Forum Contributor
    Join Date
    02-02-2016
    Location
    Indonesia
    MS-Off Ver
    Office 365
    Posts
    1,004

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    You can attach your sample workbook (without sensitive data).
    Click on GO ADVANCED and then scroll down to Manage Attachments to open the upload window.

    But if 'some other codes' you're referring to is different from your original problem than you need to start a new thread.

  10. #10
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    Ok thank you!

    Could you look at the new thread I have just posted to see if you could help me with it?

    Thanks

  11. #11
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    Akuini, the code is giving me a permission denied error70. Any idea how to fix this?

  12. #12
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,907

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    Did you remove the RowSource from the ListBox ?
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  13. #13
    Registered User
    Join Date
    06-27-2019
    Location
    UK
    MS-Off Ver
    2010
    Posts
    98

    Re: Delete an entry (row) in a userform listbox and update table on worksheet

    bakerman2, that's exactly what it was. I forgot to delete that

    Thank you.

    If you had a minute to spare could you look at my other post also about this userform?

    appreciate your help

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Userform updated listbox and remain highlight at the last update entry
    By carlrubber in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-03-2017, 12:59 PM
  2. Userform to Update Table Values based on a Listbox Selection
    By scottkelley80 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-27-2016, 08:49 PM
  3. Replies: 4
    Last Post: 08-15-2014, 04:02 PM
  4. Listbox to Listbox, no duplicates & submitting same UserForm data for each Listbox entry.
    By jamieswift1977 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-18-2012, 12:18 PM
  5. Update and delete entry in Datasheet via Userform
    By Magnet in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-11-2012, 09:50 AM
  6. [SOLVED] To update the entry to worksheet from Userform.
    By ebin charles in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 07-23-2011, 03:30 PM
  7. delete entry on worksheet via userform listbox
    By confused325 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-21-2009, 12:19 PM

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