I'd do something like below. It would be faster, if transaction list becomes large.
Private Sub CommandButton2_Click()
'Private Sub cmdSearch_Click()
Dim ws As Worksheet
Dim lr As Long, i As Long
Dim tFound As Boolean: tFound = False
Set ws = Sheets("Transactions Detail")
lr = ws.Cells(Rows.Count, 1).End(xlUp).Row
SearchArray = ws.Range("A2:F" & lr)
With Me
For i = 1 To UBound(SearchArray, 1)
If SearchArray(i, 1) = .ComboBox1.Value And SearchArray(i, 6) = DateValue(.TextBox6.Value) Then
tFound = True
.TextBox1 = SearchArray(i, 3)
.TextBox7 = SearchArray(i, 4)
.TextBox2 = SearchArray(i, 5)
Exit For
End If
Next i
End With
If Not tFound Then MsgBox "No transaction found matching search criteria. Please try again...", vbExclamation, "Not Found!"
End Sub
Bookmarks