Hi Good People,
Hoping someone could actually me on this problem. So basically, I have a textbox and a Listbox thats filter via textbox value. However, I wanted to show only a specific column of my listbox.
Below code filters my listbox.
My search starts in a2, if textbox value match the value in column A of my Sheet, then it shows all the items in listbox based on textbox value.
What I wanted to achieve is to show only lets say column B and column G only..
Is that possible? Thank you
Hoping someone could actually me on this problem. So basically, I have a textbox and a Listbox thats filter via textbox value. However, I wanted to show only a specific column of my listbox.
Below code filters my listbox.
My search starts in a2, if textbox value match the value in column A of my Sheet, then it shows all the items in listbox based on textbox value.
What I wanted to achieve is to show only lets say column B and column G only..
Is that possible? Thank you
VBA Code:
Private Sub TextBox1_Change()
Dim a, i As Long, ii As Long, n As Long, temp As String
If Len(Me.TextBox1.Value) Then
temp = UCase(Me.TextBox1.Value)
With Sheets("sheet1")
a = .Range("a2", .Range("a" & Rows.Count).End(xlUp)) _
.Resize(, 2).Value
End With
a = Application.Transpose(a)
For i = 1 To UBound(a, 2)
If UCase(a(1, i)) Like temp & "*" Or _
UCase(a(2, i)) Like temp & "*" Then
n = n + 1
For ii = 1 To UBound(a, 1)
a(ii, n) = a(ii, i)
Next
End If
Next
If n > 0 Then
ReDim Preserve a(1 To UBound(a, 1), 1 To n)
Me.ListBox1.Column = a
End If
End If
End Sub