Re: Compare data in multiple columns across 2 worksheets
Ok. This code works with your layout. However, be aware that I had to remove the timestamps in order for the dates to "match" since I'm comparing values of cells. I did that quickly using Text To Columns on the data tab in Excel. Also, on your example sheet, there were NO matches of data. I had to create a match or two to make sure the code was working with your layout. Either way, here it is:
Sub multmatch()
Dim cell As Range
Dim found As Range
Dim nameCol
Dim totalrows As Long
totalrows = ActiveSheet.UsedRange.Rows.Count
nameCol = "$U$2:$U$" & totalrows
For Each cell In Sheets("Sheet1").Range(nameCol)
Set found = Sheets("TBP").Range(nameCol).Find(cell, LookAt:=xlWhole)
For Each found In Sheets("TBP").Range(nameCol)
If found & found.Offset(0, -16) & found.Offset(0, -18) Like cell & cell.Offset(0, -16) & cell.Offset(0, -18) Then
cell.Offset(0, 5).Value = found.Offset(0, 5).Value
End If
Next found
Next cell
End Sub
Display More