Hi Charlie,

Glad my last post helped :)

 

>From a quick look I see two issues/potential issues:

1.       The syntax error:

TextBox5.Value = WorksheetFunction.VLookup(TextBox8.Value,
Range.("DBase"),2,False)

Remove the "." between "Range" and ("Dbase"):

TextBox5.Value = WorksheetFunction.VLookup(TextBox8.Value, Range
("DBase"),2,False)

2.       The Defined Names (ranges) in your workbook.  They include the
header row, which can interfere with lookup functions.  Not a high
likelihood in the exact usage that you have here, but still might be a good
idea to change.

 

P.S. In my last post, I used ActiveWorkbook.Worksheets(.).Range(.) in the
Userform_Initialize event to set up the linked cell.  You can consider if
ThisWorkbook is more appropriate than ActiveWorkbook in a given instance.  I
actually recommend always using ThisWorkbook if the workbook containing the
VBA code/userform is the workbook you mean and only using ActiveWorkbook
when you might mean another workbook---that which is on-screen at any given
moment.  Avoid pitfalls that way.  Whoops :)

Asa

 

From: excel-macros@googlegroups.com [mailto:excel-macros@googlegroups.com]
On Behalf Of Cab Boose
Sent: Saturday, February 04, 2012 10:48 PM
To: excel-macros@googlegroups.com
Subject: $$Excel-Macros$$ vlookup in Text Box

 

Hi

 

See attached worksheet.   Excel2000

 

I have  userform1  and one of the codes is to lookup a part # (in Textbox
8)( say Part # 30000 is to be entered here) in a named range called  DBase
Once located to place the description in  textbox 5(named Description)

 

This is the code as per attached workbook,  have played around with the code
but still not working.  Currently get a message for Syntax error.

 

 

 

 

Private Sub TextBox8_Change()
    TextBox5.Value = WorksheetFunction.VLookup(TextBox8.Value,
Range.("DBase"),2,False)
End Sub

 

So if 3000 entered in Part # text box8  I would expect to get in Textbox 5
the description:    Print.Download-1/64...................

 

Will have a 1000 + rows eventually. Will make the named range dynamic as
well.

 

Not much code to check.  Your advice much appreciated.

Thanks

 

Charlie

-- 
FORUM RULES (986+ members already BANNED for violation)
 
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
 
2) Don't post a question in the thread of another member.
 
3) Don't post questions regarding breaking or bypassing any security
measure.
 
4) Acknowledge the responses you receive, good or bad.
 
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited. 
 
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
 
----------------------------------------------------------------------------
--------------------------
To post to this group, send email to excel-macros@googlegroups.com

-- 
FORUM RULES (986+ members already BANNED for violation)

1) Use concise, accurate thread titles. Poor thread titles, like Please Help, 
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get 
quick attention or may not be answered.

2) Don't post a question in the thread of another member.

3) Don't post questions regarding breaking or bypassing any security measure.

4) Acknowledge the responses you receive, good or bad.

5)  Cross-promotion of, or links to, forums competitive to this forum in 
signatures are prohibited. 

NOTE  : Don't ever post personal or confidential data in a workbook. Forum 
owners and members are not responsible for any loss.

------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com

Reply via email to