Populate Userform text boxes in VBA with VLookup data from #2 worksheet

L

Laz

I'm having a difficult time with the syntax to be able to populate textbox
controls in a userform using VLookup with data in a worksheet outside of the
userform .

Can anyone help? Is it even possible to code this in VBA?

I'm using something like this in a standard module:

Dim UF as Userform
Set UF = UserFormLoanReqInpute

with UF
.tbBorr1Name = application.worksheetfunction.vlookup(.tbBorr1CIF,("C:\My
Documents\cf_details.xls!Range("Database"),3,false)

I get error #1004

Please help as I need to complete this project ASAP!

Thanks . . . . . Laz
 
M

mjbigelow

Here's what I would do:

.tbBorr1Name.Value =
Range("Database").Find(What:=.tbBorr1CIF.Value).Offset(0, 3).Value

You might want to rename database to be the first column of your
database to avoid finding records in other columns.

Let me know if that doesn't work.

Mark
 
L

Laz

OK this worked; but only if cf_detail.xls is the active workbook. How can i
code the vlookup part of the code (arg #2: range to look in) so that
cf_detail.xls does not need to be the acitve workbook?

I change it to ..........Range("Database") and it only works if
cf_details.xls is the active workbook. This workbook will not be the active
one. It looks as if I need to quality the Range("Database") whose syntax I
do not know.



Thanks in advance for the help!
Laz
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top