+ Reply to Thread
Results 1 to 14 of 14

Matching and removing matching data, and data filter with VBA (Excel 2003)

  1. #1
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Matching and removing matching data, and data filter with VBA (Excel 2003)

    HI all, i would like to find any data in A:A that matches any data in D:D and removing all names that match, i have made a example sheet and added a few notes to it, would like to do it all through VBA. thanks for any help.
    Attached Files Attached Files

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Hi Ditch1983

    Copy this code in uf2
    Please Login or Register  to view this content.
    This code for cmdremove
    Please Login or Register  to view this content.
    Last edited by sintek; 03-18-2017 at 08:46 AM.

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    This code should copy duplicates to Sheet3
    Please Login or Register  to view this content.
    Last edited by sintek; 03-18-2017 at 09:07 AM.

  4. #4
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    hey sintek thanks for the responce, these seem to do the job, only thing is what i may not have been clear about, on the one that removes any matching from the list, i need it to loop through and remove all that match in the list in 1 click, not just remove the selected 1, hope this make sense. Thanks

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Ok yeah sure, makes sense

  6. #6
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Also with the filter 1 I only want it to filter what is in the combo box, but it seems to just copy everything over. Thanks, and sorry for been a pain.

  7. #7
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Try this for uf3
    Please Login or Register  to view this content.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Hey Ditch1983

    Am stuck with listbox item find and remove....Am only able to clear as you move down listbox. Am still pretty new with vba.

  9. #9
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Ok np thanks for trying, maybe if each value is loaded into text boxes and removed that way instead of listbox ? I could then modif it to dynamically add txt boxes as needed, as there will never be more then 10 names in a list.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Hey Ditch1983

    I figured it out. This code will remove all selected in listbox
    Please Login or Register  to view this content.
    Click on listbox in Userform
    In the listbox properties, you have to set the multiselect to fmMultiSelectMulti

    Then when your form runs, you must select all the items and run macro.

  11. #11
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    ah nice one thank you for all your help Sintek, i need the whole process to be automatic but i just changed a little bit and all runs as i needed thank you again for help. here is what i changed

    Private Sub UserForm_Initialize()
    Dim i
    Dim ListArray As Variant
    With Sheets("Sheet1")
    ListArray = .Range(.Range("a2"), .Range("a" & Rows.Count).End(xlUp))
    End With
    uf2.lb1.List = ListArray

    For i = 0 To lb1.ListCount - 1
    lb1.Selected(i) = True
    Next i

    End Sub

    so now it loads list and select's all in list.

  12. #12
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Good stuff...Glad I could help.
    Please mark thread as solved on top - Thread tools
    And pretty pls click on add reputation star for rep points.

  13. #13
    Forum Contributor
    Join Date
    04-27-2014
    Location
    england
    MS-Off Ver
    excel 2003,2016 and google sheets
    Posts
    124

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Already done all that

  14. #14
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Matching and removing matching data, and data filter with VBA (Excel 2003)

    Shot thanks

+ 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. Filter two data sets my matching indexes
    By QuantumPenguin in forum Excel General
    Replies: 6
    Last Post: 04-10-2016, 09:55 AM
  2. Replies: 2
    Last Post: 05-02-2015, 10:49 AM
  3. Reverse Dedupe - Comparing 2 sheets and removing non-matching data
    By mattstkc in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 11-19-2013, 05:23 PM
  4. Finding Matching Data in one Column/Adding corresponding matching string value.
    By swade730 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-02-2013, 07:23 PM
  5. Indexing and matching data from date range and matching
    By Rickomicko in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 06-19-2013, 11:46 AM
  6. Replies: 2
    Last Post: 04-18-2013, 05:56 PM
  7. how to filter data by matching 2 duplicate columns
    By missy22 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-15-2013, 08:20 AM

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