Try it like this
Dim res as Variant
res = Application.Lookup(Sheets("MasterI&P").Range( _
Q207 & j).Value, Sheets("Answer").Range("A2:A334"), _
Sheets("Answer").Range("B2:B334"))
if iserror(res) then
msgbox "Lookup value not found"
Else
Userform1.txtIncome.Value = res
End if
The problem is more than likely that your lookup function is not successful.
--
Regards,
Tom Ogilvy
"bisjom" wrote in
message ...
Hi Guys,
I was trying to get some values from excel sheets to a form in excel
and it shows error " Type mismatch". The value in the A coulmn of the
sheet "Answer" is a number and that of B is a text. I have to get that
text value in the text box of my form. The code is as follows:
UserForm1.txtIncome.Value = Application.Lookup(Sheets("Master
I&P").Range(Q207 & j).Value, Sheets("Answer").Range("A2:A334"),
Sheets("Answer").Range("B2:B334"))
Do you know Y this error comes??
Please help
--
bisjom
------------------------------------------------------------------------
bisjom's Profile:
http://www.excelforum.com/member.php...o&userid=31206
View this thread: http://www.excelforum.com/showthread...hreadid=508799