#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,080
Default 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" wrote in message
...
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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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
...
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" wrote in message
...
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
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 2 July 20th 09 11:18 PM
Comparing List A to List B and add what's missing from List B Gilbert Excel Discussion (Misc queries) 1 July 20th 09 08:41 PM
validation list--list depends on the selection of first list Michael New Users to Excel 2 April 27th 06 10:23 PM
list 1 has 400 names List 2 has 4000. find manes from list 1 on 2 Ed Excel Worksheet Functions 5 September 12th 05 09:48 AM
find names on list 1 in list 2. list 1 4000 names list 2 400 name Ed Excel Worksheet Functions 1 September 4th 05 12:48 AM


All times are GMT +1. The time now is 08:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"