Hello Przemyslav,
Welcome to the Forum!
This is a very common problem for beginners using the Find method in VBA. You need to use a range object variable to hold the result of the find operation. If successful then the object points to the cell where the match was found. If no match is made then the object variable is set to the special object value of Nothing. The object variable needs to be checked to decide what action needs to be taken.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim FoundIt As Range
If Target.Count = 1 Then
If Target = Range("C1") Then
Set FoundIt = Columns("AK").Find(what:=Target.Value, Lookat:=xlWhole)
If FoundIt Is Nothing Then MsgBox Target & " Not Found.": Exit Sub
Application.EnableEvents = False: FoundIt.Select: Application.EnableEvents = True
End If
End If
End Sub
Bookmarks