+ Reply to Thread
Results 1 to 2 of 2

double click option in listbox outputs to cell in excel 97 !

  1. #1
    Registered User
    Join Date
    07-22-2005
    Location
    canada
    Posts
    73

    Exclamation double click option in listbox outputs to cell in excel 97 !

    Hello,

    First off... The solution has to work in excel 97 !

    I am having a little trouble trying to figure this out.
    I have been able to get a simple listbox, to get a range of data from
    another worksheet in the same workbook, and it works just fine,
    using this following code:

    *********************************

    Private Sub CommandButton1_Click()
    Dim ListItems As Variant, i As Integer
    With Me.ComboBox1
    .Clear ' remove existing entries from the listbox
    Application.ScreenUpdating = False
    ListItems = Worksheets("data").Range("A2:A8").Value
    Application.ScreenUpdating = True
    ListItems = Application.WorksheetFunction.Transpose(ListItems)
    ' convert values to a vertical array
    For i = 1 To UBound(ListItems)
    .AddItem ListItems(i) ' populate the listbox
    Next i
    .ListIndex = -1 ' no items selected, set to 0 to select the first item
    End With

    *********************************

    However, my issue where I'm stumped, is if I could double click on a
    single option and it would output that same option to a specific cell in the
    same worksheet as the listbox ?

    Thank you VERY much in advance,

    spyrule.
    Last edited by spyrule; 07-11-2006 at 11:31 PM.

  2. #2
    Norman Jones
    Guest

    Re: double click option in listbox outputs to cell in excel 97 !

    Hi SpyRule,

    Try:

    '=============>>
    Private Sub ListBox1_DblClick(ByVal _
    Cancel As MSForms.ReturnBoolean)
    Me.Range("A1").Value = Me.ListBox1.Value
    End Sub
    '<<============

    Or, using the simple change event:

    '=============>>
    Private Sub ListBox1_Change()
    Me.Range("A1").Value = Me.ListBox1.Value
    End Sub
    '<<=============

    ---
    Regards,
    Norman



    "spyrule" <[email protected]> wrote in
    message news:[email protected]...
    >
    > Hello,
    >
    > First off... The solution has to work in excel 97 !
    >
    > I am having a little trouble trying to figure this out.
    > I have been able to get a simple listbox, to get a range of data from
    > another worksheet in the same workbook, and it works just fine.
    >
    > However, my issue where I'm stumped, is if I could double click on a
    > single option and it would output that same option to a specific cell
    > in the
    > same worksheet as the listbox ?
    >
    > Thank you VERY much in advance,
    >
    > spyrule.
    >
    >
    > --
    > spyrule
    > ------------------------------------------------------------------------
    > spyrule's Profile:
    > http://www.excelforum.com/member.php...o&userid=25489
    > View this thread: http://www.excelforum.com/showthread...hreadid=560541
    >




+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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