+ Reply to Thread
Results 1 to 5 of 5

Deleting item in filtered Listbox

  1. #1
    Registered User
    Join Date
    10-24-2019
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Deleting item in filtered Listbox

    Hi,

    I've been searching for a code which simply allows a user to delete selected item from my listbox when i click delete button which removes the item from both listbox and on the Sheet.

    The listbox is filtered with specific value. Below is the code i used but this only remove item in the listbox but not in the sheet. I attached a sample of the file.

    Please Login or Register  to view this content.
    Appreciate for any help.

    Thanks!
    Attached Files Attached Files
    Last edited by DelfinT; 11-25-2019 at 05:34 PM. Reason: Updated to meet Forum Rule #2

  2. #2
    Forum Expert
    Join Date
    12-14-2012
    Location
    London England
    MS-Off Ver
    MS 365 Office Suite.
    Posts
    8,448

    Re: Deleting item in filtered Listbox

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however you need to include code tags around your code.

    Please take a moment to add the tags. Posting code between tags makes your code much easier to read and copy for testing, and it also maintains VBA formatting.

    Please see Forum Rule #2 about code tags and adjust accordingly. Click on Edit to open your post, then highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here

    (Note: this change is not optional. No help to be offered until this moderation request has been fulfilled.)
    My General Rules if you want my help. Not aimed at any person in particular:

    1. Please Make Requests not demands, none of us get paid here.

    2. Check back on your post regularly. I will not return to a post after 4 days.
    If it is not important to you then it definitely is not important to me.

  3. #3
    Registered User
    Join Date
    10-24-2019
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Re: Deleting item in filtered Listbox

    Thanks for the advise about the rules. It was now updated.

  4. #4
    Forum Expert
    Join Date
    01-23-2013
    Location
    USA
    MS-Off Ver
    Microsoft 365 aka Office 365
    Posts
    3,863

    Re: Deleting item in filtered Listbox

    Hi DelfinT,

    You were very close. You did all the heavy lifting by including the Spreadsheet row number (hidden) in the 5th column of your ListBox.

    Since you are using a 'Single Selection ListBox', you do not have to scan all the rows of the ListBox.

    Try the following code:
    Please Login or Register  to view this content.
    To prevent typos from ruining days and weeks of work 'Option Explicit' is NEEDED at the top of each code module. This prevents errors caused by missspellings and FORCES every variable to be DECLARED (e.g. Dim i as Integer). https://www.excel-easy.com/vba/examp...-explicit.html

    Lewis

  5. #5
    Registered User
    Join Date
    10-24-2019
    Location
    Philippines
    MS-Off Ver
    2010
    Posts
    8

    Re: Deleting item in filtered Listbox

    Nice it works!!

    Thanks a lot Lewis!

    Delfin

+ 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. [SOLVED] Add and substract on a text box when deleting an item from a listbox
    By dddddmex in forum Excel General
    Replies: 3
    Last Post: 11-13-2019, 01:48 PM
  2. Filtered ListBox Selected item delete in sheet Entire Row
    By sijostephen in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-05-2019, 05:38 PM
  3. vba excel - last listbox item transfer erasing all listbox items except last item
    By terriertrip in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 11-06-2017, 03:48 PM
  4. [SOLVED] if anything in listbox select first item, if listbox empty do nothing (listbox in userform
    By mcdermott2 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-17-2015, 12:49 PM
  5. Run Time Error when Deleting last Item in ListBox
    By gunsmith01 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 12-11-2014, 03:05 AM
  6. [SOLVED] Deleting Duplicate item in listbox
    By zicktechnology in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 01-22-2013, 05:57 AM
  7. Listbox fails to update after deleting an item
    By skysurfer in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 08-09-2010, 01:15 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