Results 1 to 7 of 7

ListBox Double Click () selection from another worksheet and populate data in text box

Threaded View

imzhakmaya ListBox Double Click ()... 09-01-2014, 11:11 PM
alansidman Re: ListBox Double Click ()... 09-01-2014, 11:32 PM
imzhakmaya Re: ListBox Double Click ()... 09-01-2014, 11:39 PM
imzhakmaya Re: ListBox Double Click ()... 09-02-2014, 12:13 AM
mike7952 Re: ListBox Double Click ()... 09-02-2014, 12:31 AM
imzhakmaya Re: ListBox Double Click ()... 09-02-2014, 01:24 AM
AlphaFrog Re: ListBox Double Click ()... 09-02-2014, 03:49 AM
  1. #1
    Registered User
    Join Date
    08-31-2014
    Location
    Singapore
    MS-Off Ver
    2013
    Posts
    18

    ListBox Double Click () selection from another worksheet and populate data in text box

    Hi,

    I have been trying to search for the correct codes in my List Box double Click () for the userform that I have interfaced but to no avail.

    Would appreciate if some one can help me with the following:

    1) List Box to select item code from Database worksheet
    2) Msgbox to indicate the item code number when selected
    3) Textboxes and option button to populate from list box selection


    Private Sub ListBox1_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    Dim iRow As Long
    Dim rng As Range
    Dim ws As Worksheet
    Set ws = Worksheets("Database")
    
    '   find the correct row to draw data from, based on
    '       the item code selected
    ''iRow = ws.Cells(Rows.Count, 1) _
    ''  .End(xlUp).Offset(1, 1).Row
    iRow = ws.Cells.Find(What:=Me.ListBox1, SearchOrder:=xlByRows, _
            SearchDirection:=xlNext, _
            LookIn:=xlValues, MatchCase:=True).Row
        
    'check for a item code
    If ListBox1.Value = False Then
             'If ListIndex is -1, nothing selected
            MsgBox "Nothing was selected!"
        Else
             'If ListIndex not -1 inform user what was selected
            MsgBox "You selected " & ListBox1.Value, vbOKCancel
        If MsgResponse = Ok Then
    '   display the result in the text box
    
        Me.TextBox3.Value = ws.Cells(iRow, 2).Value
        Me.TextBox4.Value = ws.Cells(iRow, 3).Value
        Me.TextBox5.Value = ws.Cells(iRow, 4).Value
        Me.TextBox7.Value = ws.Cells(iRow, 5).Value
        Me.TextBox8.Value = ws.Cells(iRow, 6).Value
        Me.TextBox6.Value = ws.Cells(iRow, 7).Value
        Me.TextBox9.Value = ws.Cells(iRow, 8).Value
        Me.TextBox10.Value = ws.Cells(iRow, 10).Value
      End If
      End If
    End Sub
    Also, when I double click the output doesn't select the data instead displaying the labels
    Attached Images Attached Images
    Last edited by alansidman; 09-01-2014 at 11:32 PM. Reason: code tags added

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Double click from List Box and populate data into another cell
    By shaneg1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 05-27-2013, 04:16 AM
  2. [SOLVED] Userform opened by double click containing data from worksheet
    By amurray2307 in forum Excel Programming / VBA / Macros
    Replies: 11
    Last Post: 04-17-2013, 11:51 AM
  3. double click to copy data to another worksheet
    By BBQ in forum Excel General
    Replies: 2
    Last Post: 12-01-2008, 09:09 PM
  4. populate listbox based on selection in previous listbox
    By sarahng86 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 10-28-2007, 10:55 PM
  5. Need selected item from listbox after double click
    By peterfarge@hotmail.com in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-23-2006, 11:20 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