Hello biglifter,
This macro has been added to the attaached workbook. There is button on the "Names" sheet to run the macro.
Sub CopyNamesAndData()
Dim Cell As Range
Dim DSO As Object
Dim Key As Variant
Dim Keys As Variant
Dim Item As Variant
Dim R As Long
Dim Rng As Range
Dim RngEnd As Range
Dim InfoWks As Worksheet
Dim NamesWks As Worksheet
Dim SummaryWks As Worksheet
R = 2
Set InfoWks = Worksheets("Info")
Set NamesWks = Worksheets("Names")
Set SummaryWks = Worksheets("Sheet3")
Set Rng = InfoWks.Range("A2")
Set RngEnd = Rng.Parent.Cells(Rows.Count, Rng.Column).End(xlUp)
Set Rng = IIf(RngEnd.Row < Rng.Row, Rng, Rng.Parent.Range(Rng, RngEnd))
Set DSO = CreateObject("Scripting.Dictionary")
DSO.CompareMode = vbTextCompare
For Each Cell In Rng.Cells
Key = Trim(Cell & Cell.Offset(0, 1))
If Key <> "" Then
If Not DSO.Exists(Key) Then
DSO.Add Key, Cell
End If
End If
Next Cell
Set Rng = NamesWks.Range("A2")
Set RngEnd = Rng.Parent.Cells(Rows.Count, Rng.Column).End(xlUp)
Set Rng = IIf(RngEnd.Row < Rng.Row, Rng, Rng.Parent.Range(Rng, RngEnd))
For Each Cell In Rng.Cells
Key = Trim(Cell & Cell.Offset(0, 1))
If Key <> "" Then
If DSO.Exists(Key) Then
DSO(Key).EntireRow.Copy SummaryWks.Cells(R, "A")
R = R + 1
End If
End If
Next Cell
Set DSO = Nothing
End Sub
Bookmarks