Results 1 to 29 of 29

Matching Data

Threaded View

  1. #4
    Forum Expert
    Join Date
    05-29-2020
    Location
    NH USA
    MS-Off Ver
    365
    Posts
    2,103

    Re: Matching Data

    I have a solution for you. I think that a "misspelling" mentioned above was actually on purpose, as you probably want to capture the name whether the surname or the first name is on the list. I did not include the naming solution, but made it so that you achieve your requested results. Let me know if you have questions.
    Sub Pass1()
       Dim Ary As Variant
       Dim i As Long
       With Sheets("Sheet1")
          Ary = .Range("b2", .Range("b" & Rows.Count).End(xlUp)).Value2
       End With
        With CreateObject("scripting.dictionary")
            .comparemode = 1
            For i = 1 To UBound(Ary)
                .Item(Ary(i, 1)) = Empty
            Next i
            With Sheets("Sheet2")
                Ary = .Range("A1", .Range("A" & Rows.Count).End(xlUp)).Value2
            End With
            For i = 2 To UBound(Ary)
                If .Exists(Ary(i, 1)) Then .Remove Ary(i, 1)
            Next i
          Ary = .keys
        End With
        Dim Dest As Range
        Set Dest = Range("d3")
        Set Dest = Dest.Resize(UBound(Ary)+1, 1)
        Dest.Value = Application.Transpose(Ary)
      
        pass2
        
    End Sub
    Sub pass2()
       Dim Ary As Variant
       Dim i As Long
       With Sheets("Sheet2")
          Ary = .Range("a2", .Range("a" & Rows.Count).End(xlUp)).Value2
       End With
        With CreateObject("scripting.dictionary")
            .comparemode = 1
            For i = 1 To UBound(Ary)
                .Item(Ary(i, 1)) = Empty
            Next i
            With Sheets("Sheet1")
                Ary = .Range("b2", .Range("b" & Rows.Count).End(xlUp)).Value2
            End With
            For i = 1 To UBound(Ary)
                If .Exists(Ary(i, 1)) Then .Remove Ary(i, 1)
            Next i
          Ary = .keys
        End With
        Dim Dest As Range
        Set Dest = Range("f3")
        Set Dest = Dest.Resize(UBound(Ary) + 1, 1)
        Dest.Value = Application.Transpose(Ary)
        
       
    End Sub
    The file is too large to upload. I will try to shrink and upload asap.
    Attached Files Attached Files
    Last edited by maniacb; 06-27-2020 at 09:23 PM. Reason: Corrections to response

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 1
    Last Post: 03-27-2019, 11:57 PM
  2. [SOLVED] Matching and removing matching data, and data filter with VBA (Excel 2003)
    By Ditch1983 in forum Excel Programming / VBA / Macros
    Replies: 13
    Last Post: 03-18-2017, 04:41 PM
  3. 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
  4. 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
  5. Matching Data between Files , Deleting Matching Rows
    By nem_vdoxx in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-20-2013, 11:00 AM
  6. Replies: 2
    Last Post: 04-18-2013, 05:56 PM
  7. SQL Query to get count of matching & non-matching data from two tables
    By Kiran2012 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-13-2013, 10:32 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