Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Search List of Data

Hi All

Not an area I have explored before so any help appreciated.

I have a range of data in three columns of a worksheet (the data), I have a
userform with a text box control into which the user enters a value
(string).

Another combo box control on the same userform is currently empty. I wish
to use the string entered by the user to search column 1 of the data, if it
is found (and it may find it more than once) the combo box is filled with
the values in the associated second column of the data. If not a message is
displayed.

The user then scans the combobox contents and select the required matching
record. After which a third control on the userfrom shows the value in the
associated third column of the data.

Cheers
Nigel




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Search List of Data

Private Sub Combobox1_Click()
set rng = Range(cells(1,1),cells(rows.count,1).end(xlup))
combobox2.clear
for each cell in rng
if cell.value = combobox1.Value then
combobox2.AddItem cell.offset(0,1).Value
end if
Next
End If

Private Sub Combobox2_Click()
set rng = Range(cells(1,1),cells(rows.count,1).end(xlup))
combobox3.clear
for each cell in rng
if cell.value = combobox1.Value then
if cell.offset(0,1).value = combobox2.Value then
combobox3.AddItem cell.offset(0,2).Value
End if
end if
Next
End If


--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
Hi All

Not an area I have explored before so any help appreciated.

I have a range of data in three columns of a worksheet (the data), I have

a
userform with a text box control into which the user enters a value
(string).

Another combo box control on the same userform is currently empty. I wish
to use the string entered by the user to search column 1 of the data, if

it
is found (and it may find it more than once) the combo box is filled with
the values in the associated second column of the data. If not a message

is
displayed.

The user then scans the combobox contents and select the required matching
record. After which a third control on the userfrom shows the value in

the
associated third column of the data.

Cheers
Nigel




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption

=---


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 172
Default Search List of Data

As usual Tom, simple and elegant. I now have a great template to use.

Cheers
Nigel

"Tom Ogilvy" wrote in message
...
Private Sub Combobox1_Click()
set rng = Range(cells(1,1),cells(rows.count,1).end(xlup))
combobox2.clear
for each cell in rng
if cell.value = combobox1.Value then
combobox2.AddItem cell.offset(0,1).Value
end if
Next
End If

Private Sub Combobox2_Click()
set rng = Range(cells(1,1),cells(rows.count,1).end(xlup))
combobox3.clear
for each cell in rng
if cell.value = combobox1.Value then
if cell.offset(0,1).value = combobox2.Value then
combobox3.AddItem cell.offset(0,2).Value
End if
end if
Next
End If


--
Regards,
Tom Ogilvy


"Nigel" wrote in message
...
Hi All

Not an area I have explored before so any help appreciated.

I have a range of data in three columns of a worksheet (the data), I

have
a
userform with a text box control into which the user enters a value
(string).

Another combo box control on the same userform is currently empty. I

wish
to use the string entered by the user to search column 1 of the data, if

it
is found (and it may find it more than once) the combo box is filled

with
the values in the associated second column of the data. If not a

message
is
displayed.

The user then scans the combobox contents and select the required

matching
record. After which a third control on the userfrom shows the value in

the
associated third column of the data.

Cheers
Nigel




----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet

News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000

Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via

Encryption
=---






----== Posted via Newsfeed.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeed.com The #1 Newsgroup Service in the World! 100,000 Newsgroups
---= 19 East/West-Coast Specialized Servers - Total Privacy via Encryption =---
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
Data Validation list search Pete_UK Excel Discussion (Misc queries) 1 September 30th 09 03:54 PM
Search for a specific entry in a long data validation list Heinrich Excel Discussion (Misc queries) 1 May 4th 07 07:29 PM
How to search for the last higher value from a list? Eric Excel Discussion (Misc queries) 5 December 5th 06 07:26 AM
Value Search From a List in a Column Duncan Excel Discussion (Misc queries) 3 October 14th 05 11:30 AM
Search in a list. comotoman Excel Discussion (Misc queries) 3 September 19th 05 07:22 PM


All times are GMT +1. The time now is 07:18 PM.

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

About Us

"It's about Microsoft Excel"