Private Sub CommandButton1_Click()
Dim r As Variant, c As Variant
If Me.ComboBox2.ListIndex = -1 Then
MsgBox "No sheet selected. ", , "Invalid Entry"
Exit Sub
ElseIf Me.ComboBox1.ListIndex = -1 Then
MsgBox "No name selected. ", , "Invalid Entry"
Exit Sub
ElseIf Not IsDate(Me.TextBox1.Value) Then
MsgBox "Invalid date. ", , "Invalid Entry"
Exit Sub
End If
Sheets(Me.ComboBox2.Value).Select
r = Application.Match(Me.ComboBox1.Value, Range("A:A"), 0)
If IsError(r) Then
MsgBox "No match for " & Me.ComboBox1.Value, , "No Name Match Found"
Exit Sub
End If
c = Application.Match(CLng(CDate(Me.TextBox1.Value)), Rows(r), 0)
If IsError(c) Then
MsgBox "No match for date " & Me.TextBox1.Value, , "No Date Match Found"
Exit Sub
End If
Cells(r, c).ClearContents
End Sub
Bookmarks