Ok, so if I understand correctly, your not saying to add the words to the "Compare" named range, but rather, add them to the NoMatch range, and then rename the range to include the addition.
The following should do it. I also put in a check to not add the word to the NoMatch range if it is already there, and to sort the range after each addition.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim Result As String, RowNum As Long
If Target.Address = Range("Word").Address Then
If Trim(Range("Word").Address) <> "" Then
On Error Resume Next
Result = Application.WorksheetFunction.VLookup(Trim(Range("Word").Value), Range("Compare"), 1, False)
If Result = "" Then
Result = Application.WorksheetFunction.VLookup(Trim(Range("Word").Value), Range("NoMatch"), 1, False)
If Result = "" Then
Call AddToList
End If
End If
On Error GoTo 0
End If
End If
End Sub
Sub AddToList()
With Range("NoMatch")
If .Cells(1, 1).Value = "" Then
.Value = Range("Word").Value
RowNum = .Row
Else
RowNum = Cells(Rows.Count, .Column).End(xlUp).Row + 1
Cells(RowNum, .Column).Value = Range("Word").Value
End If
Range(Cells(.Row, .Column), Cells(RowNum, .Column)).Name = "NoMatch"
End With
With Range("NoMatch")
.Sort Key1:=.Range("A1"), Order1:=xlAscending
End With
End Sub
Bookmarks