Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 923
Default 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
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
Drop down lists from multiple source lists RoofIL Excel Worksheet Functions 3 February 18th 10 09:44 PM
LISTS- adding info without repeat to other lists Jemimastar Excel Discussion (Misc queries) 1 December 1st 06 09:29 PM
Multiple lists with repeated values for dependet drop down lists mcmanusb Excel Worksheet Functions 1 September 29th 06 12:13 AM
Comparing Lists to Partial Lists depuyus[_7_] Excel Programming 0 August 5th 04 01:43 PM
Form lists influencing other lists chanteribby Excel Programming 1 November 6th 03 03:39 AM


All times are GMT +1. The time now is 10:17 AM.

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"