+ Reply to Thread
Results 1 to 3 of 3

List box

  1. #1
    Greg B
    Guest

    List box

    What would I use to do the following?

    I have a userform which looks up the names of people on a list. I want the
    user form to show all the surnames starting with b for example. Then I
    would like the ability to click on the name in the list I want to select
    that paticular name.

    Thanks in advance

    Greg



  2. #2
    Vasant Nanavati
    Guest

    Re: List box

    Let's say your list of surnames is in A1:A100.

    Sub UserForm_Initialize()
    Dim c As Range
    For Each c In Range("A1:A100").Cells
    If Left(c, 1) = "B" Then ListBox1.AddItem c
    Next
    End Sub

    Of course, you will need additional code because I assume you want to do
    something with the selected name after clicking on the ListBox.

    --

    Vasant


    "Greg B" <[email protected]> wrote in message
    news:[email protected]...
    > What would I use to do the following?
    >
    > I have a userform which looks up the names of people on a list. I want

    the
    > user form to show all the surnames starting with b for example. Then I
    > would like the ability to click on the name in the list I want to select
    > that paticular name.
    >
    > Thanks in advance
    >
    > Greg
    >
    >




  3. #3
    Greg B
    Guest

    Re: List box

    That is great thanks I can write the code wasn't sure on how to get that
    part to happen.

    Thank you Vasant

    Greg
    "Vasant Nanavati" <vasantn *AT* aol *DOT* com> wrote in message
    news:[email protected]...
    > Let's say your list of surnames is in A1:A100.
    >
    > Sub UserForm_Initialize()
    > Dim c As Range
    > For Each c In Range("A1:A100").Cells
    > If Left(c, 1) = "B" Then ListBox1.AddItem c
    > Next
    > End Sub
    >
    > Of course, you will need additional code because I assume you want to do
    > something with the selected name after clicking on the ListBox.
    >
    > --
    >
    > Vasant
    >
    >
    > "Greg B" <[email protected]> wrote in message
    > news:[email protected]...
    > > What would I use to do the following?
    > >
    > > I have a userform which looks up the names of people on a list. I want

    > the
    > > user form to show all the surnames starting with b for example. Then I
    > > would like the ability to click on the name in the list I want to select
    > > that paticular name.
    > >
    > > Thanks in advance
    > >
    > > Greg
    > >
    > >

    >
    >




+ 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