Results 1 to 6 of 6

Get selection from ListBox and copy to TextBox (USERFORM)

Threaded View

nordicdust Get selection from ListBox... 01-05-2019, 12:23 PM
Akuini Re: Get selection from... 01-05-2019, 04:09 PM
nordicdust Re: Get selection from... 01-05-2019, 04:33 PM
Akuini Re: Get selection from... 01-05-2019, 07:19 PM
nordicdust Re: Get selection from... 01-05-2019, 07:42 PM
Akuini Re: Get selection from... 01-05-2019, 08:54 PM
  1. #1
    Forum Contributor
    Join Date
    03-08-2018
    Location
    Denmark
    MS-Off Ver
    2016 for Windows
    Posts
    413

    Get selection from ListBox and copy to TextBox (USERFORM)

    Happy New Year
    And Thank you for taking a look at my problem.

    What i have:
    A Userform where I type a zip code in the textBox and while typing the ListBox shows the matching possibilities from a Range.
    The Range is merged cells from a Table where I have Zip code in Col 1 and City in Col 2.
    I can only search by ZipCode.

    Example workBook Uploaded.



    What I relly would like:
    - A Userform where I would like a way to type in the textBox while the ListBox shows the values from a Table with Zip code in Col 1 and City in Col 2.
    - While typing in TextBox the ListBox should only show matching possibilities.
    - I would like the option of searching by either Zip Code or City.
    - The ListBox should show Zip Code and Matching City (As in merged Cells on Sheet)
    - A way to Select the value from the ListBox to the TextBox.

    Any Help is much appreciated


    A Snip of my code so far:
    Private Sub Txb_POSTNR_BY_Change()
    
    Dim a
    Dim firstAddress As String
    Me.Listbox_RESULTAT.Clear
    
    With ThisWorkbook.Worksheets("ENGINE").Range("Q2:Q159")
    Set a = .Find(Txb_POSTNR_BY.Text, LookIn:=xlValues, LookAt:=xlPart)
    If Not a Is Nothing Then
    firstAddress = a.Address
    
    Do
        Me.Listbox_RESULTAT.AddItem a.Text
            Set a = .FindNext(a)
                Loop While Not a Is Nothing And a.Address <> firstAddress
                Else
            MsgBox "No Match Found"
        End If
    End With
    
    End Sub
    
    Private Sub UserForm_Initialize()
    Listbox_RESULTAT.List = ThisWorkbook.Worksheets("ENGINE").Range("Q2:Q159").Value
    End Sub
    Udklip.PNG
    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] Userform copy textbox value to different range depending on Combobox selection
    By icsiszer in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 07-11-2018, 03:42 AM
  2. [SOLVED] ListBox Selection to TextBox
    By gsandy in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-26-2017, 12:25 AM
  3. VBA - Userform - Listbox validation and Listbox to Textbox
    By stevefisher85 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-04-2016, 07:11 AM
  4. Userform ListBox depending on a previous Listbox selection
    By Figolu in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2015, 04:31 PM
  5. Userform ListBox depending on a previous Listbox selection
    By Figolu in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-23-2015, 02:08 PM
  6. [SOLVED] Add each Listbox Selection to Textbox
    By coreytroy in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-22-2014, 07:17 PM
  7. [SOLVED] UserForm - How To Make TextBox Value Change Depending On ListBox Selection
    By ScotyB in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 11-26-2013, 05:05 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