+ Reply to Thread
Results 1 to 6 of 6

fast filter data on listbox with textbox

Hybrid View

totalchaoz fast filter data on listbox... 09-14-2016, 04:42 AM
LeoTaxi Re: fast filter data on... 09-14-2016, 06:06 AM
totalchaoz Re: fast filter data on... 09-18-2016, 04:40 AM
bakerman2 Re: fast filter data on... 09-14-2016, 06:56 AM
totalchaoz Re: fast filter data on... 09-18-2016, 04:41 AM
bakerman2 Re: fast filter data on... 09-18-2016, 06:28 AM
  1. #1
    Registered User
    Join Date
    11-24-2015
    Location
    Indonesia
    MS-Off Ver
    2007
    Posts
    3

    fast filter data on listbox with textbox

    i have data on listbox based on sheet, and i want filter data on listbox based on textbox, thank's masters
    Attached Files Attached Files

  2. #2
    Forum Expert
    Join Date
    08-16-2015
    Location
    Antwerpen, Belgium
    MS-Off Ver
    2007-2016
    Posts
    2,380

    Re: fast filter data on listbox with textbox

    With sheet2 as helper

    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
    Kind regards
    Leo
    Attached Files Attached Files

  3. #3
    Registered User
    Join Date
    11-24-2015
    Location
    Indonesia
    MS-Off Ver
    2007
    Posts
    3

    Re: fast filter data on listbox with textbox

    Thank's I got it, Tralaa, xixixixi.....Perfecto

  4. #4
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,358

    Re: fast filter data on listbox with textbox

    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.
    Attached Files Attached Files
    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.

  5. #5
    Registered User
    Join Date
    11-24-2015
    Location
    Indonesia
    MS-Off Ver
    2007
    Posts
    3

    Re: fast filter data on listbox with textbox

    Thank's Very Much, Master bakerman2 and LeoTaxi, I Got It....xixxixixi

  6. #6
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MSO Home and Business 2024
    Posts
    7,358

    Re: fast filter data on listbox with textbox

    You're very welcome and thanks for adding rep points.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Problem with display textbox when filter the data in listbox
    By lacromo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-27-2015, 08:28 AM
  2. [SOLVED] VBA code to filter listbox as you type in a textbox Solved by : Sixthsense
    By HaroonSid in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 03-27-2014, 10:51 AM
  3. Fast search and filter data
    By Hamsan in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-18-2014, 05:06 PM
  4. VBA Code To Filter Listbox As You Type In A Textbox
    By Benjamin2008 in forum Excel General
    Replies: 3
    Last Post: 12-20-2013, 08:57 PM
  5. [SOLVED] Filter Listbox Values based on Textbox input
    By redocs in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-17-2013, 04:59 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1