Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help:Find and Display


Hi!
I have a *form*, 2 textbox (*textbox1 *and *text box2*), and a
*button*.
worksheet has *column A* and *Column B*.
ex.
column A column B
Item1 1,000

i want the *button* to search *column A* with the data i've entered in
*textbox1* and displays the corresponding value in *column B* in
*textbox2*.


--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=570977

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Help:Find and Display

Have a look at the Find Method of the Range Object. There's an
example in the VBA help showing how to use it.

This could be useful!:

Private Sub cmdSearch_Click()

Set searchRng = Sheets(1).Range("A:A")

With searchRng
Set resultRng = .Find(TextBox1.Text, LookIn:=xlValues)

TextBox2.Text = TextBox2.Text & Sheets(1).Range("B" &
result.Row).Value & vbCrLf

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Help:Find and Display



TextBox2.Text = TextBox2.Text & Sheets(1).Range("B" &
result.Row).Value & vbCrLf


spotted a typo above: result.Row should be resultRng.Row

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help:Find and Display


Thank you Sir,
this is so much help.

*just another question*.
what if the data i want to search is not in the list,
how do i code it?

*thanks*!

Tony James Wrote:

TextBox2.Text = TextBox2.Text & Sheets(1).Range("B" &
result.Row).Value & vbCrLf


spotted a typo above: result.Row should be resultRng.Row



--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=570977

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 15
Default Help:Find and Display

Insert the following in the If statement:

Else
MsgBox TextBox1.Text & " not found."



  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Help:Find and Display


thanks
but how do i start the if statement?
i really dont know how and where to code it


--
kenrose08
------------------------------------------------------------------------
kenrose08's Profile: http://www.excelforum.com/member.php...o&userid=22317
View this thread: http://www.excelforum.com/showthread...hreadid=570977

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
Find And Display Surname robzrob Excel Worksheet Functions 9 June 18th 08 08:00 PM
Find one character or another and display c8tz Excel Worksheet Functions 3 January 18th 08 06:05 AM
Find max # and display name [email protected] Excel Discussion (Misc queries) 2 September 13th 07 09:17 PM
Find and display information PGB Excel Programming 1 April 30th 04 06:56 PM
Find display the result Simon Excel Programming 5 January 18th 04 07:00 PM


All times are GMT +1. The time now is 12:07 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"