I'm trying to compare keywords from sheet 1 to sheet 2 and return keywords that do not have a match. I'm at a loss as to what my problem is here.
Sub CompareKeywords()
Dim keyword As Variant
Dim matchFound As Boolean
'Loop through each keyword in sheet 1
For Each keyword In Sheets("Sheet1").Range("A:A")
'Search for the keyword in sheet 2
matchFound = False
For Each cell In Sheets("Sheet2").Range("A:A")
If keyword = cell.value Then
matchFound = True
Exit For
End If
Next cell
'If the keyword was not found in sheet 2, add it to the list of keywords without matches
If Not matchFound Then
Dim lastUsedCell As Range
Set lastUsedCell = Sheets("Sheet1").Cells(Sheets("Sheet1").Rows.Count, "B").End(xlDown)
lastUsedCell.Offset(1, 0).value = keyword
End If
Next keyword
End Sub
I'm getting a runtime error 1004 Application Defined or Object Defined error
What am I missing?