I have wrote a code to find if a value exists in other sheet then if exists it selects the cell. The code worked without any errors when I have implemented it, but when I have closed and reopened excel it throws the Run-time error 91. My code below:
Dim rngCell As Excel.Range
Dim Rng As Excel.Range
Dim FindCell As String
If Not Intersect(Target, Range("C8:O8")) Is Nothing Then
For Each rngCell In Intersect(Target, Range("C8:O8"))
FindCell = rngCell.Value
With Sheets("Master List").Range("A:A")
Set Rng = .Find(What:=FindCell)
If Not Rng Is Nothing Then
With Sheets("Master List").Select
Selection.Find(What:=FindCell).Activate
End With
Else
'do nothing'
End If
End With
Next rngCell
Sheets("Data Input").Select
End If
End Sub
The error is on the line Selection.Find(What:=FindCell).Activate I understand that it might be because FindCell is not assigned as an object? Weird that it worked before, so I have no idea how to fix it.
I tried to find this in previous questions, but couldn't get it from there.
Thanks, Adam