Excel’s VLOOKUP Function How to Use It and How to Nest ItExcel VBA: No Experience Necessary - Lesson 1Excel VBA: No Experience Necessary - Lesson 2Excel VBA: No Experience Necessary - Lesson 3Excel VBA: No Experience Necessary - Lesson 4Excel VBA–No Experience Necessary: Lesson 5Sub TestPings() Dim cell As Range Dim astr() As StringExcel FAQ - Excel 101 - Xtreme Visual Basic TalkExcel - My Excel PagesExamplesGetting Started with Macros and User Defined FunctionsVB(A) functionsExcel for Windows Visual Basic for Applications 101Regular Expressionsregexp PatternsVB(A) functionsExcel - Xtreme Visual Basic TalkExcel FAQ - Excel 101 - Xtreme Visual Basic TalkKickbutt VBA Find Function - Excel Help & VBA Helpexcel-vba-findall-method=========================================================
Sub Comp()
Dim rSource As Range, rTarget As Range, SourceRow%, TargetRow%
Set rSource = ActiveWorkbook.Sheets(2).Range("A2").CurrentRegion
Set rTarget = ActiveWorkbook.Sheets(1).Range("A2").CurrentRegion
For SourceRow = 2 To rSource.Rows.Count
For TargetRow = 2 To rTarget.Rows.Count
If rSource.Cells(SourceRow, 8).Value = rTarget.Cells(TargetRow, 8).Value And _
rSource.Cells(SourceRow, 3).Value = rTarget.Cells(TargetRow, 3).Value And _
rSource.Cells(SourceRow, 6).Value = rTarget.Cells(TargetRow, 6).Value Then
rTarget.Cells(TargetRow, 4).Value = rSource.Cells(SourceRow, 4).Value
rTarget.Cells(TargetRow, 5).Value = rSource.Cells(SourceRow, 5).Value
rTarget.Cells(TargetRow, 7).Value = rSource.Cells(SourceRow, 7).Value
End If
Next TargetRow
Next SourceRow
End Sub