Excel macro using Find function
I am a novice in VBA and I am trying to create a complex (for me) macro for an Excel 2013 file.
I am trying to use the Find function and I am getting different results when I run the same macro a number of times.
When I first open the worksheets involved and run the following code it works.
Dim city As String
city = Range("C" & masrowno)
Sheets("Eureka").Select
Range("A1").Select
Cells.Find(What:=city, After:=ActiveCell, LookIn:=xlValues, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
But at some point, while I am trying to perfect the rest of the macro, it stops working with either
Run-time error '91' most often OR
Run-time error '13' occasionally
Once I get the error I can't get it to run properly again.
I have used
Cells.Find AND
Selection.Find
But again, once I get the error I can't get it to run properly again.
I have used Find in other very simple macros and don't have any problems.
What might I be missing in this macro?