ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   lookup value in sheet (https://www.excelbanter.com/excel-programming/361245-lookup-value-sheet.html)

eyesonly1965[_9_]

lookup value in sheet
 

in my form i have 2 textboxes that i'm trying to link.
for example:
textbox1= code
textbox2= disciption

in a sheet i have a range
in cells a1 to a100 there are codes
in cells b1 to b100 there are the discriptions

now is my question if it is possible to give the code in textbox1 and
textbox2 shows the discription automaticly.

can anybody tell me if it is possible and how it is done?


--
eyesonly1965
------------------------------------------------------------------------
eyesonly1965's Profile: http://www.excelforum.com/member.php...o&userid=34199
View this thread: http://www.excelforum.com/showthread...hreadid=541297


eyesonly1965[_10_]

lookup value in sheet
 

is there anyone who can help me with this problem?:eek:


--
eyesonly1965
------------------------------------------------------------------------
eyesonly1965's Profile: http://www.excelforum.com/member.php...o&userid=34199
View this thread: http://www.excelforum.com/showthread...hreadid=541297


RAZA

lookup value in sheet
 

HI

THE BELOW CODE WILL SOLVE YOU PROBLEM

Private Sub TextBox1_Change()
Cells.Find(What:=TextBox1.Value, After:=ActiveCell, LookIn:=xlFormulas,
LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
TextBox2.Value = ActiveCell.Offset(0, 1).Value

End Sub


DO LET ME KNOW IF THIS WORKS

REGARDS
RAZA


--
RAZA
------------------------------------------------------------------------
RAZA's Profile: http://www.excelforum.com/member.php...o&userid=34186
View this thread: http://www.excelforum.com/showthread...hreadid=541297


eyesonly1965[_11_]

lookup value in sheet
 

thanx,

the code works perfectly, it does excacly what i want.

greetings eyesonly1965;)


--
eyesonly1965
------------------------------------------------------------------------
eyesonly1965's Profile: http://www.excelforum.com/member.php...o&userid=34199
View this thread: http://www.excelforum.com/showthread...hreadid=541297


eyesonly1965[_12_]

lookup value in sheet
 

the code works perfectly when the input is found in the sheet,
but when the input is not found i get an error 91 (objectvariable or
blockvariable is not set).

and then you can end the code or debug, both i don't want.
because when you push the end button you have to start all over again.
and i don't want users to push the debug button, so they can screw up
the code.

this is what i have now.

-Private Sub txtBestellingArtikelCode2_Change()

ActiveWorkbook.Sheets("artikelen").Activate
Cells.Find(What:=txtBestellingArtikelCode2.Value,
After:=ActiveCell, LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False).Activate
txtBestellingArtikelOmschrijving2.Value = ActiveCell.Offset(0,
1).Value

End Sub-

what i want it to do with a false input is that the value of
txtBestellingArtikelOmschrijving2 is set to not known.
can anybody help me?:confused:


--
eyesonly1965
------------------------------------------------------------------------
eyesonly1965's Profile: http://www.excelforum.com/member.php...o&userid=34199
View this thread: http://www.excelforum.com/showthread...hreadid=541297


RAZA

lookup value in sheet
 

Private Sub TextBox1_Change()

Set Avalue = Cells.Find(What:=TextBox1.Value, After:=ActiveCell,
LookIn:=xlFormulas, LookAt:= _
xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext,
MatchCase:=False _
, SearchFormat:=False)
if Avalue is nothing then msgbox "Item not found" else Avalue.select
TextBox2.Value = ActiveCell.Offset(0, 1).Value

End Sub


--
RAZA
------------------------------------------------------------------------
RAZA's Profile: http://www.excelforum.com/member.php...o&userid=34186
View this thread: http://www.excelforum.com/showthread...hreadid=541297



All times are GMT +1. The time now is 05:33 PM.

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