+ Reply to Thread
Results 1 to 6 of 6

Show search results in Userform

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Show search results in Userform

    I made a userform where i like to search in a drop down list for a "KKS" and when selected a "KKS" the info "KKS benaming", "Gecre?erd door" and "Omschrijving" is given.

    I tried to make a code to only show non empty cells in de KKS droplist. This isn't working. I don't know why?
    Attached Files Attached Files

  2. #2
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Show search results in Userform

    I tried this but somehow the is an error in Me("Textbox" & p)...... line?

    Private Sub ComboBox1_Change()
    Dim q, p As Long
    
    q = Application.WorksheetFunction.CountA(Blad1.Range("B:B"))
    
    For p = 1 To 3
    Me("Textbox" & p).Value = Application.WorksheetFunction.VLookup(CLng(Me.ComboBox1.Value), Blad1.Range("B" & 2, "p" & q), p + 1, 0)
    
    Next p
    
    
    End Sub

  3. #3
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Show search results in Userform

    See next code
    Private Sub UserForm_Initialize()
    Dim cell As Range
        With Sheets("Blad1")
            Me.ComboBox1.RowSource = ""
            For Each cell In .Range("B2:B" & .ListObjects(1).ListRows.Count + 1)
                If Not IsEmpty(cell) Then ComboBox1.AddItem cell.Value
            Next cell
        End With
    End Sub
    - Battle without fear gives no glory - Just try

  4. #4
    Forum Expert
    Join Date
    10-11-2021
    Location
    Netherlands
    MS-Off Ver
    365
    Posts
    1,505

    Re: Show search results in Userform

    This is enough (first empty the rowsource property of your combobox)

    Private Sub UserForm_Initialize()
    ComboBox1.List = Filter([transpose(if(LOTOTO<>"",LOTOTO))], False, 0)
    End Sub

  5. #5
    Forum Contributor
    Join Date
    01-29-2019
    Location
    Drenthe, Netherlands
    MS-Off Ver
    Dutch Office 2019
    Posts
    291

    Re: Show search results in Userform

    Thanks all!

    Someone knows how te do this with a Textbox?
        Dim i As Integer
        For i = 1 To 7
        
        With ListBox1
            TextBox(4 + i).Text = .List(.ListIndex, 0 + i)
           
        End With

  6. #6
    Forum Expert
    Join Date
    12-24-2007
    Location
    Alsace - France
    MS-Off Ver
    MS 365 Office Suite
    Posts
    5,088

    Re: Show search results in Userform

    Please Frigide open a new thread and give back information about the first issue

+ 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. [SOLVED] VBA Userform to search data in a table filtering results based on all search criteria
    By matt7416 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 11-05-2020, 05:09 AM
  2. Search and display results in userform Issue. Results are incorrect
    By olypro in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-07-2019, 10:16 AM
  3. Search Folder and Show Results in Userform List Box
    By powerplug in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2016, 05:18 AM
  4. Userform:Search through all ws / show results in Listbox
    By wali in forum Excel Programming / VBA / Macros
    Replies: 20
    Last Post: 01-22-2015, 09:56 PM
  5. Show Search results in userform and edit
    By cruiser102 in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 12-21-2012, 07:57 PM
  6. Show Search results in userform
    By StartingOut in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2012, 07:51 PM
  7. UserForm to search sheet, show results on separate userform?
    By egemenkepekci in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-25-2010, 01:06 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