how can I add textbox as search to this code. I need it to search for a single column for different textbox, for example textbox1 search in column C, textbox2 search in column E, and textbox3 search in column K
VBA Code:
Private Sub txt_sn1_Change()
Dim Sh As Worksheet
Dim Rng As Range
Dim Cell As Range
Dim r As Integer
Set Sh = Worksheets("Systemtest")
With Sh
Set Rng = .Range("A1:A" & .Cells(.Rows.Count, 1).End(xlUp).Row)
End With
ReDim b(1 To 1, 1 To 11) '
With ListBox1
.ColumnCount = 11 '
.List = b '
.Clear '
End With
'
r = 0
For Each Cell In Rng
With Cell
ListBox1.AddItem .Value
ListBox1.List(r, 1) = .Offset(0, 1).Value
ListBox1.List(r, 2) = .Offset(0, 2).Value
ListBox1.List(r, 3) = .Offset(0, 3).Value
ListBox1.List(r, 4) = .Offset(0, 4).Value
ListBox1.List(r, 5) = .Offset(0, 5).Value
ListBox1.List(r, 6) = .Offset(0, 6).Value
ListBox1.List(r, 7) = .Offset(0, 7).Value
ListBox1.List(r, 8) = .Offset(0, 8).Value
ListBox1.List(r, 9) = .Offset(0, 9).Value
ListBox1.List(r, 10) = .Offset(0, 10).Value
End With
r = r + 1
Next Cell
End Sub