ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Auto look up (https://www.excelbanter.com/excel-programming/326977-auto-look-up.html)

Greg[_20_]

Auto look up
 
I use this code below to look up a number in a sheet
I was wanting to extend this to be able to have both textbox1 and textbox2
to have the look up ability




Private Sub TextBox1_Enter()

Dim ans

On Error Resume Next
ans = Application.Match(CLng(TextBox1.Text), Range("A1:A100"), 0)
If Not IsError(ans) Then
TextBox2.Text = Application.Index(Range("B1:B100"), ans)
TextBox3.Text = Application.Index(Range("C1:C100"), ans)
Else
MsgBox "Invalid code"
End If
On Error GoTo 0
End Sub

Thanks

Greg



Greg[_20_]

Auto look up
 
Why wont the code in the joining message not look up names?

Greg




All times are GMT +1. The time now is 08:13 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com