Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Lists and Look ups
From your description I believe this might be what you are looking for,
adapt if not! My naming convention (change as you need) is as follows Sheet1 contains the list with columns 1 (the key value) and columns 2 and 3 the reference values Sheet2 has three form controls Textbox1 the entered value, ComboBox1 and ComboBox2 that hold the reference values from sheet1 columns 2 and 3 respectively. The code below is stored in sheet2, and when the user enters a value in Textbox1 and then clicks out of the control the combo boxes are filled with matching reference values from sheet1. If no match then the error box is displayed. Private Sub TextBox1_LostFocus() Dim xlr As Long, xr As Long, xfound As Boolean With Sheets("Sheet1") xlr = .Cells(Rows.Count, "A").End(xlUp).Row ComboBox1.Clear ComboBox2.Clear xfound = False For xr = 1 To xlr If Trim(.Cells(xr, 1)) = Trim(TextBox1.Value) Then xfound = True ComboBox1.AddItem .Cells(xr, 2) ComboBox2.AddItem .Cells(xr, 3) End If Next xr If xfound Then ComboBox1.ListIndex = 0 ComboBox2.ListIndex = 0 Else MsgBox "Value not found" TextBox1.Activate End If End With End Sub -- Cheers Nigel "Pre_Live_Wire" wrote in message ... I have a 2 sheet workbook. 1 Sheet has 3 columns of data. The first column has some duplicate data. On the second sheet, i want to create a form that when entering an item in the first column, it will search the 1st column of the 1st sheet and then in columns 2 and 3 offer the coresponding options from the first sheet. Thank you. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Drop down lists from multiple source lists | Excel Worksheet Functions | |||
LISTS- adding info without repeat to other lists | Excel Discussion (Misc queries) | |||
Multiple lists with repeated values for dependet drop down lists | Excel Worksheet Functions | |||
Comparing Lists to Partial Lists | Excel Programming | |||
Form lists influencing other lists | Excel Programming |