Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Using Find & FindNext in a form
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
Reply to thread
Message
[QUOTE="BernzG, post: 6042408"] Hi Patrick, Thanks for this tried it and it works okay. Have now modified it slightly to show the list box results afte textbox1 has been updated. Once data has been entered into textbox1 textbox1 is hidden and the listbox now appears with all the record with the same ID as in textbox1. You can select an entry in th listbox and the data in TextBox2 & 3 are updated. Cheers, Bernz Private Sub TextBox1_AfterUpdate() Dim Loc As String Loc = Format(TextBox1.Value, "####") Sheets("Sheet1").Select Cells.Find(What:=Loc, After:=ActiveCell, LookIn:=xlValues, LookAt: _ xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext).Activate With Worksheets("Sheet1") Set c = .Range("B:B").Find(Loc, LookIn:=xlValues) TextBox2 = .Cells(c.Row, 3) TextBox3 = .Cells(c.Row, 4) End With ListBox1.Visible = True TextBox1.Visible = False ListBox1.Clear With Worksheets("Sheet1") Set found = .Cells.Find(What:=Loc) If Not found Is Nothing Then Loc = found.Address Do ListBox1.AddItem .Cells(found.Row, 3) ListBox1.List(ListBox1.ListCount - 1, 1) = .Cells(found.Row, 4) Set found = .Cells.FindNext(found) Loop While found.Address <> Loc End If End With End Sub Private Sub ListBox1_Click() With ListBox1 TextBox2 = .List(.ListIndex, 0) TextBox3 = .List(.ListIndex, 1) End With End Sub Private Sub UserForm1_Initialize() ListBox1.ColumnCount = 2 End Su [/QUOTE]
Verification
Post reply
Forums
Archive
Newsgroup Archive
Excel Newsgroups
Excel Programming
Using Find & FindNext in a form
Top