Try this instead:Function FindRowNumber(strText) As IntegerDim TryFind As RangeWith ActiveSheet.Range("A1:A3000")Set TryFind = .Find(strText)If Not TryFind Is Nothing ThenMsgBox TryFind.RowElseMsgBox "Not found!"End IfEnd WithEnd Function