i have data on listbox based on sheet, and i want filter data on listbox based on textbox, thank's masters
i have data on listbox based on sheet, and i want filter data on listbox based on textbox, thank's masters
With sheet2 as helper
Kind regards![]()
Private Sub TextBox1_Change() lr = Range("A" & Rows.Count).End(xlUp).Row ActiveSheet.Range("A1", "B" & lr).AutoFilter Field:=2, Criteria1:="=*" & TextBox1 & "*", Operator:=xlAnd On Error GoTo vervolg With Sheets("sheet2") .Cells.ClearContents Range("A2", "B" & lr).SpecialCells(xlCellTypeVisible).Copy .Range("A1") arr = .Range("A1").CurrentRegion ListBox1.List = arr Range("A1", "B" & lr).AutoFilter End With Exit Sub vervolg: MsgBox "No records with characters : " & TextBox1 TextBox1 = "" ListBox1.Clear End Sub Private Sub UserForm_Initialize() With Sheets("data_barang") lr = .Range("A" & Rows.Count).End(xlUp).Row arr = .Range("A2", "B" & lr) ListBox1.List = arr End With End Sub
Leo
Thank's I got it, Tralaa, xixixixi.....Perfecto
Different approach.
Select name in combobox with unique, sorted values. Click button to filter listbox.
I chose for Commandbutton because using Change-event leads to excesive filtering of listbox.
Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.
Thank's Very Much, Master bakerman2 and LeoTaxi, I Got It....xixxixixi
You're very welcome and thanks for adding rep points.![]()
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks