What I have
1- I am currently matching Column A with Column G in an array
2- If records match then debug.print "match" for each record
Dim rngPrimary_Key As Range
Set rngPrimary_Key = ThisWorkbook.Range("A2:A" & SourceLastRow)
Dim Foreign_Key As Variant
Foreign_Key = ThisWorkbook.Range("G2:G" & TargetLastRow).Value
Dim v
For i = LBound(Foreign_Key, 1) To UBound(Foreign_Key, 1)
v = Foreign_Key(i, 1)
m = Application.Match(v, rngPrimary_Key, 0)
If Not IsError(m) Then
Debug.Print "Match"
Else
Debug.Print "No Match"
End If
Next i
What I need
1- Add Another matching criteria (If Column B Match with Column H) in an array where (Column A match with Column G) also then
2- debug print "match" for each record
Dim rngPrimary_Key2 As Range
Set rngPrimary_Key2 = ThisWorkbook.Range("B2:B" & SourceLastRow)
Dim Foreign_Key As Variant
Foreign_Key = ThisWorkbook.Range("H2:H" & TargetLastRow).Value
How to combine this part for both
Where (Cells in A match G) & (Cells in B match H), only then combine match in m formula.
For i = LBound(Foreign_Key, 1) To UBound(Foreign_Key, 1)
v = Foreign_Key(i, 1)
m = Application.Match(v, rngPrimary_Key, 0)
Next i