I am using VB6 and Excel 2000

I am getting the following error:

'Object variable or With block variable not set' with the following code, BUT only when the cell value matches the RowName variable:

Public Function doesRowExist(ExcelWorkSheet As Excel.Worksheet, Column As String, RowName As String) As Boolean
Dim blnExists As Boolean
Dim i As Integer

blnExists = False
'on error goto HandleError
For i = 1 To 1000
If ExcelWorkSheet.Range(Column & i).Value = RowName Then
blnExists = True
Exit For
End If
Next

Set ExcelWorkSheet = Nothing
doesRowExist = blnExists

Exit Function
HandleError:
doesRowExist = False
Set ExcelWorkSheet = Nothing
End Function