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

Hi
I am trying to get a textbox (textbox2) in a userform to vlookup data
(entered into textbox1) from cells ("a1:b10"). Can anybody please
advise if this can be done and how?
thanks

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Userform Textbox

Dim Res as Variant

res = application.vlookup(me.textbox1.value, _
thisworkbook.worksheets("sheet999").range("a1:B10" ),2,false)

if iserror(res) then
me.textbox2.value = "No match, the board goes back"
else
me.textbox2.value = res
end if


====
You may want to change the workbook and the sheetname, though.

wrote:

Hi
I am trying to get a textbox (textbox2) in a userform to vlookup data
(entered into textbox1) from cells ("a1:b10"). Can anybody please
advise if this can be done and how?
thanks


--

Dave Peterson
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,202
Default Userform Textbox

I am trying to get a textbox (textbox2) in a userform to vlookup data
(entered into textbox1) from cells ("a1:b10"). Can anybody please
advise if this can be done and how?


Maybe you can use the VBA Find function instead. Assuming you are looking up
your values in Column A and returning the corresponding values from Column
B, I would think this code could be used (change the Find properties as
required)...

On Error Resume Next
TextBox2.Text = ActiveSheet.Range("A1:A10").Find( _
What:=TextBox1.Text, MatchCase:=False, _
SearchOrder:=xlByColumns).Offset(0, 1).Value
If Err.Number Then TextBox2.Text = "No Match Found"

Rick

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 695
Default Userform Textbox

Private Sub TextBox1_Change()
On Error Resume Next
Me.TextBox2 = ""
Me.TextBox2 = Range("A1:A10").Find(Me.TextBox1, LookIn:=xlValues).Offset(0, 1)
End Sub


" skrev:

Hi
I am trying to get a textbox (textbox2) in a userform to vlookup data
(entered into textbox1) from cells ("a1:b10"). Can anybody please
advise if this can be done and how?
thanks


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
UserForm TextBox LaDdIe Excel Programming 2 September 3rd 07 04:56 PM
Userform TextBox LaDdIe Excel Programming 4 August 11th 07 08:32 AM
TEXTBOX in USERFORM RUUD VAN DEURSEN Excel Programming 5 March 1st 05 03:36 PM
Textbox in userform shaharul[_6_] Excel Programming 3 April 15th 04 12:54 PM
UserForm TextBox to ActiveSheet TextBox over 256 characters Dan E[_2_] Excel Programming 1 July 28th 03 07:36 PM


All times are GMT +1. The time now is 01:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"