abdo meghari
Well-known Member
- Joined
- Aug 3, 2021
- Messages
- 726
- Office Version
- 2019
hi
I need modified this code to become searching based on multiple textboxes (textbox1,2,3)= COLS( D,E,F) . currently the code works based on COL D with textbox1
any help would be appreciate
I need modified this code to become searching based on multiple textboxes (textbox1,2,3)= COLS( D,E,F) . currently the code works based on COL D with textbox1
VBA Code:
Private Sub TextBox1_Change()
Dim myArray, lr, x, i
Dim DATA As Worksheet
Set DATA = Worksheets("purchase")
lr = DATA.Cells(Rows.Count, 4).End(xlUp).Row
ListBox1.Clear
If TextBox1.Text = "" Then Exit Sub
myArray = DATA.Range("A2:G" & lr + 1)
ReDim y(1 To UBound(myArray) * 7, 1 To 7)
For i = LBound(myArray) To UBound(myArray)
a = Len(Me.TextBox1.Text)
For x = 1 To 7
If Left(myArray(i, x), a) = Left(TextBox1.Text, a) Then
rw = rw + 1
For yy = 1 To 7
y(rw, yy) = myArray(i, yy)
Next yy
End If
Next
Next i
If rw > 0 Then
ListBox1.List = y()
End If
End Sub
any help would be appreciate