Vlookup Formual in VB

5 pts.
Tags:
Programming
Visual Basic
I have the following code that keeps being displayed as "run time error 1004 for application or object defined error. Sub formula() Sheets("Depletions").Activate Range("G8:G156").formula = "=IF(IF(ISERROR(VLOOKUP(B8,'Banfi DA '!$D$5:$P$266,7,FALSE)),"",VLOOKUP(B8,'Banfi DA '!$D$5:$P$266,7,FALSE))=0,"",IF(ISERROR(VLOOKUP(B8,'Banfi DA '!$D$5:$P$266,7,FALSE)),"",VLOOKUP(B8,'Banfi DA '!$D$5:$P$266,7,FALSE)))" End Sub When I replace the formula with something more simple it works. I have also pasted this formula in excel and it gives me the desired result, but I can create the code. Could you please tellme what I am doing wrong. Thank you!

Answer Wiki

Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Discuss This Question:  

 
There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when members answer or reply to this question.

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

To follow this tag...

There was an error processing your information. Please try again later.

Thanks! We'll email you when relevant content is added and updated.

Following

Share this item with your network: