Below is a code that searches for a value in a cell in excel. I want a code that would check to see if the word has been found or not. When I do the search and the word is not found, I get an error message " Object Variable or With block variable not set".
I know the above message comes up only when the word is not found. How can I by pass this inorder to tell the user through a message box that the document does not exist. That way the will be able to create a new record.
word = frmSearch.txtEnterDate.Text If frmSearch.cboSystems.ListIndex = 0 Then Sheets("Current").Select Range("A1").Select 'Selection.End(xlDown).Select Range("A1:A65536").Find(What:=word, LookAt:=xlWhole, LookIn:=xlValues, SearchOrder:=xlByColumns).Activate