Consulting

Results 1 to 3 of 3

Thread: Solved: Place Mult Select Listbox selections in specified cells

  1. #1
    VBAX Regular
    Joined
    Jun 2007
    Posts
    18
    Location

    Solved: Place Mult Select Listbox selections in specified cells

    I am attempting to modifiy this borrowed code which creates a multi-select dropdown listbox. The name selections are dynamically linked to another sheet, when selections are made they are put at the end of the column F.

    What i am having difficulty with is changing where the selections are made. I want the selections to be placed in cells $F$3 thru $F$9, instead of at the end.

    The dropdown list contains names. These names would placed in the excel form to show operators present for shift rotation.

    Please advise.

    Thanks,
    Anna
    ~~~~~~~~~~~~~~~~~~~~~


    Private Sub CheckBox1_Click()
    Dim lItem As Long
    For lItem = 0 To ListBox1.ListCount - 1
    ListBox1.Selected(lItem) = CheckBox1
    Next
    End Sub
    Private Sub CommandButton1_Click()
    Unload Me
    End Sub
    Private Sub CommandButton2_Click()
    Dim lItem As Long
    For lItem = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(lItem) = True Then
    'ActiveSheet.Range("A65536").End(xlUp)(2, 1) = ListBox1.List(lItem)
    ActiveSheet.Range("F65536").End(xlUp)(2, 1) = ListBox1.List(lItem)
    ListBox1.Selected(lItem) = False
    End If
    Next
    End Sub
    Private Sub ListBox1_Click()
    End Sub

    Private Sub UserForm_Click()
    End Sub

    **Module for button
    Sub showit()
    UserForm1.Show
    End Sub

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    Private Sub CommandButton2_Click()
    Dim lItem As Long
    Dim cell As Range
    Set cell = ActiveSheet.Range("F3")
    For lItem = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(lItem) = True Then
    cell.Value = ListBox1.List(lItem)
    Set cell = cell.Offset(1, 0)
    ListBox1.Selected(lItem) = False
    End If
    Next
    End Sub
    [/vba]
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    VBAX Regular
    Joined
    Jun 2007
    Posts
    18
    Location
    Solved. Thanks!This works perfectly.




    -Anna-

Posting Permissions

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