![]() |
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 =--- |
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 =--- |
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 =--- |
All times are GMT +1. The time now is 12:21 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com