+ Reply to Thread
Results 1 to 3 of 3

Single Select Multi Columns Listbox to Populate value in Textbox

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Single Select Multi Columns Listbox to Populate value in Textbox

    Hello Gurus,

    I have a multi-columns listbox which is single-select and also i have two textboxes.
    How can I display the value of the second column in my second textbox?

    I have the below code that display the columns in my Listbox:

    Private Sub UserForm_Initialize()
    
    Dim lngMyRow As Long
    
        For lngMyRow = 2 To Cells(Rows.Count, "B").End(xlUp).Row
        
            If StrConv(Range("T" & lngMyRow), vbUpperCase) = "WAITING FOR APPROVAL" Then
    
                With ListBox1
                    .ColumnCount = 3
                    .ColumnWidths = "125;60;110"
                    .AddItem
                    .List(.ListCount - 1, 0) = Range("B" & lngMyRow)
                    .List(.ListCount - 1, 1) = Range("I" & lngMyRow)
                    .List(.ListCount - 1, 2) = Range("F" & lngMyRow)
                End With
    
            End If
            
        Next lngMyRow
    
    
      End Sub
    And below to display the 1st column in my 1st textbox.

    Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    
    UserForm1.txt_sc.Value = ListBox1.Value
    
    End Sub
    Thanks in advance!

  2. #2
    Forum Expert Tinbendr's Avatar
    Join Date
    06-26-2012
    Location
    USA
    MS-Off Ver
    Office 2010
    Posts
    2,138

    Re: Single Select Multi Columns Listbox to Populate value in Textbox

    Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    
         UserForm1.txt_sc.Value = ListBox1.List(Me.ListBox1.ListIndex,2)
    
    End Sub
    David
    (*) Reputation points appreciated.

  3. #3
    Forum Contributor
    Join Date
    02-26-2013
    Location
    Philippines
    MS-Off Ver
    Excel 2007
    Posts
    367

    Re: Single Select Multi Columns Listbox to Populate value in Textbox

    Thanks tinbendr!

+ 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] ListBox Multi-Select - Help
    By KyrieInfinity in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 10-08-2013, 12:54 AM
  2. [SOLVED] Multi Select ListBox, 4 columns, use NamedRange, Columns to use in list Nonconsecutive
    By CRIMEDOG in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 04-29-2013, 11:01 AM
  3. How to Populate another Range from a Multi-Select ListBox ?
    By Winon in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 10-19-2011, 04:49 PM
  4. Multi-Select ListBox
    By yawnzzzz in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-17-2011, 08:55 AM
  5. [SOLVED] Listbox Multi Select
    By MikeT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-27-2006, 03:30 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