Results 1 to 3 of 3

Populating listbox

Threaded View

Mahmoudelnemr Populating listbox 06-21-2019, 03:59 PM
Fluff13 Re: Populating listbox 06-22-2019, 09:29 AM
bakerman2 Re: Populating listbox 06-22-2019, 11:43 AM
  1. #1
    Forum Contributor
    Join Date
    05-14-2019
    Location
    Alex, Egypt
    MS-Off Ver
    365
    Posts
    254

    Populating listbox

    I managed to make userform with search textbox and listbox to display the search result
    the current case is that the search result of search textbox "TextBox26" (the first 10 columns of the table in DT sheet ) are displayed in the listbox1, if textbox26 is clear then the listbox is clear
    what i need is that all the record are displayed in the listbox by default and then the search box only filter the record displayed in the list box
    i mean when the search box is clear the listbox displays all the records and the search box is used to filter this records

    the code in the search box "TextBox26" is as follow

    Private Sub TextBox26_Change()
    
        Dim a, i As Long, temp
        Me.ListBox1.Clear
        If Me.TextBox26 = "" Then Exit Sub
        temp = LCase$(Me.TextBox26)
        a = Sheets("DT").ListObjects("DT.Data.Table").DataBodyRange.Value
        With Me.ListBox1
            .ColumnCount = 15
            For i = 1 To UBound(a, 1)
                If (LCase$(a(i, 1)) Like "*" & temp & "*") + (a(i, 2) Like "*" & temp & "*") + (a(i, 3) Like "*" & temp & "*") + (a(i, 4) Like "*" & temp & "*") Then
                    .AddItem
                    .List(.ListCount - 1, 0) = a(i, 1)
                    .List(.ListCount - 1, 1) = a(i, 2)
                    .List(.ListCount - 1, 2) = a(i, 3)
                    .List(.ListCount - 1, 3) = a(i, 4)
                    .List(.ListCount - 1, 4) = a(i, 5)
                .List(.ListCount - 1, 5) = a(i, 6)
                    .List(.ListCount - 1, 6) = a(i, 7)
                    .List(.ListCount - 1, 7) = a(i, 8)
                    .List(.ListCount - 1, 8) = a(i, 9)
                    .List(.ListCount - 1, 9) = a(i, 10)
                 
                    
                   
                    
                End If
            Next
        End With
    End Sub
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Populating Multi-Column Listbox with Conditions from Another Listbox
    By ykobure in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-05-2015, 02:28 AM
  2. User Form ListBox - Find Records (ListBox Populating Issue)
    By LONeillSSC in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 07-20-2015, 12:06 PM
  3. [SOLVED] Need help with populating Listbox from another Listbox(selection); across userforms.
    By SoulPrisoner in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-28-2013, 12:54 PM
  4. Having problems populating a multicolumn listbox changing Listbox column with a loop.
    By Aristizabal95 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-11-2013, 12:41 PM
  5. Populating a listbox based on column of first listbox
    By tucanj in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 01-13-2013, 09:26 PM
  6. Populating 1 listbox on the basis of another listbox selections
    By protocol in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 08-22-2011, 07:33 AM
  7. Listbox of Unique Records populating another listbox
    By web2xs in forum Excel General
    Replies: 1
    Last Post: 04-16-2009, 11:27 PM

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