+ Reply to Thread
Results 1 to 2 of 2

Choosing items in a list box

Hybrid View

  1. #1
    David Gerstman
    Guest

    Choosing items in a list box

    I am writing a macro to print timesheets.
    In case that the secretary doesn't want to print one out for every person in
    the branch I want a userform to select one or individuals.
    How do I create a userform with names and corresponding checkboxes so the
    user may select individuals to generate the desired time sheets.

  2. #2
    Harald Staff
    Guest

    Re: Choosing items in a list box

    If you can manage with a standard listbox where you select with click, ctrl
    click or shift click then try this:

    Private Sub UserForm_Initialize()
    Dim L As Long
    With Me.ListBox1
    ..MultiSelect = fmMultiSelectExtended
    For L = 1 To 20
    ..AddItem Sheets(1).Cells(L, 1).Value
    Next
    End With
    End Sub

    Private Sub CommandButton1_Click()
    Dim L As Long
    For L = 0 To ListBox1.ListCount - 1
    If ListBox1.Selected(L) = True Then _
    MsgBox ListBox1.List(L)
    Next
    End Sub

    HTH. Best wishes Harald

    "David Gerstman" <dhgerstman@NOSPAM.hotmail.com> skrev i melding
    news:2EC4C106-C04A-4FB3-9A60-7211D94F585A@microsoft.com...
    > I am writing a macro to print timesheets.
    > In case that the secretary doesn't want to print one out for every person

    in
    > the branch I want a userform to select one or individuals.
    > How do I create a userform with names and corresponding checkboxes so the
    > user may select individuals to generate the desired time sheets.




+ 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