Results 1 to 3 of 3
  1. #1
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    ListBox Return (XL97: SR2)

    I utilize the following code to return the item selected in a listbox. The source of the listbox is in Col A & B. I can return any item selected in Col A but would like to pass the adjacent cell in Col B to a variable in the code. I only want the User to see and therefore select an item from Col A.

    The code I'm using is:

    For X = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(X) = True Then
    oReturnCol_A = ListBox1.List(X) 'returns item selected in Col A
    oReturnCol_B = ???? 'returns item selected in Col B
    End If
    Next X


    Any thoughts?

    Thanks,
    John

  2. #2
    Gold Lounger
    Join Date
    Feb 2001
    Location
    Dublin, Ireland, Republic of
    Posts
    2,697
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Re: ListBox Return (XL97: SR2)

    If the source starts as A1 then

    oReturnCol_B = Range("A1").Offset(X,1).Value

    might get what you want.

    Andrew C

  3. #3
    Silver Lounger
    Join Date
    Dec 2000
    Location
    California, USA
    Posts
    1,758
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: ListBox Return (XL97: SR2)

    Andrew,

    That did the trick.

    Thanks,
    John

Posting Permissions

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