I have a button that when pressed uses an InputBox to ask for a date. The user enters a date and then VBA should search the worksheet for the date the user entered and return the entire row(s) that had the date specified. So far, I have the input box, a little validation, a match function and a loop. I get an error on "info!" in the line (If WorksheetFunction.CountIf(info!, usrInput) = 0) that says Type mismatch. This is where I get stuck, I am currently googling but thought I would post here as well. if this code will do what I need it to once the type error gets sorted out, how can I return the entire row(s) if it has the date searched for?
VBA Code:
Sub Search()
usrInput = InputBox("Please enter a date", "search", "enter date as DD/MM/YYYY")
If usrInput = "" Then Exit Sub
If WorksheetFunction.CountIf(info!, usrInput) = 0 Then
MsgBox "Not found"
Else
rr = WorksheetFunction.Match(usrInput, info!, 0)
For c = 1 To 45 'range of columns to search'
Data = Data & Cells(rr, c) & "-"
Next c
MsgBox (Data)
End If
End Sub