Hi all,
I'm working on a macro to autofilter a column based on text entry from the user. I've managed to get this to work, but I want a message saying "No Records Found" to be displayed if the filter results in zero visible rows i.e. the record that the user has entered/searched for does not exist.
This is my code so far:
Any help would be appreciated. Please let me know if there's any information I've missed that you need.
Thanks.
I'm working on a macro to autofilter a column based on text entry from the user. I've managed to get this to work, but I want a message saying "No Records Found" to be displayed if the filter results in zero visible rows i.e. the record that the user has entered/searched for does not exist.
This is my code so far:
Code:
Sub SearchFamilyIDTest()
Dim searchBox As String
On Error GoTo Errorcatch
searchBox = InputBox("Please Enter a Family to Search For:")
If searchBox = vbNullString Then Exit Sub
Sheet1.Range("$A$1:$J$102").AutoFilter Field:=1, Criteria1:=searchBox
Exit Sub
Errorcatch:
MsgBox Err.Description
End Sub
Any help would be appreciated. Please let me know if there's any information I've missed that you need.
Thanks.