Results 1 to 13 of 13

Thread: Lookup using a list box

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #6
    Site Admin
    Jedi Master
    VBAX Guru Jacob Hilderbrand's Avatar
    Joined
    Jun 2004
    Location
    Roseville, CA
    Posts
    3,712
    Location
    Lets say you have the track info in Column H as you indicte with this code:


    Private Sub lstSelection_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    MsgBox Worksheets("SalesCatalog").Range("H1")
    End Sub

    So Row 1 corresponds to listbox listindex 0 (since the listindex starts at 0)
    So then Row 2 should have the data for the second choice from the listbox etc.

    change the code a bit to make the row a variable


    Private Sub lstSelection_DblClick(ByVal Cancel As MSForms.ReturnBoolean)
    MsgBox Worksheets("SalesCatalog").Range("H" & lstSelection.ListIndex + 1)
    End Sub
    Last edited by Aussiebear; 04-29-2023 at 07:21 PM. Reason: Adjusted the code tags

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •