Formula syntax, "Object-defined error"

  • Thread starter Thread starter michael_mcclellan
  • Start date Start date
M

michael_mcclellan

Does anyone see anything obviously wrong with the following VB code?
The formula I know to be correct. Is there some syntax missing or
something? I'm getting an error: "Application-defined or
object-defined error."

Thank you in advance.

ActiveCell.FormulaR1C1 = _
"=IF(H4<50000,H4*LOOKUP(G4,'PL Lookup'!$A$29:$A$70,'PL
Lookup'!$C$29:$C$70),IF(AND(H4>50000,H4<200000),50000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+(G4-50000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL
Lookup'!$D$29:$D$70),IF(AND(H4>200000,H4<500000),50000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+150000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$D$29:$D$70)+(H4-200000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL
Lookup'!$E$29:$E$70),IF(H4>500000,50000*LOOKUP(H4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+150000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$D$29:$D$70)+200000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$A$29:$A$70)+(H4-500000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$F$29:$F$70)))))"
 
Michael,

If you are using A1 notation, don't assign R1C1 formula

ActiveCell.Formula = _
"=IF(H4<50000,H4*LOOKUP(G4,'PL Lookup'!$A$29:$A$70,'PL
Lookup'!$C$29:$C$70),IF(AND(H4>50000,H4<200000),50000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+(G4-50000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL
Lookup'!$D$29:$D$70),IF(AND(H4>200000,H4<500000),50000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+150000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$D$29:$D$70)+(H4-200000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL
Lookup'!$E$29:$E$70),IF(H4>500000,50000*LOOKUP(H4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$C$29:$C$70)+150000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$D$29:$D$70)+200000*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$A$29:$A$70)+(H4-500000)*LOOKUP(G4,'PL
Lookup'!$A$29:$A$70,'PL Lookup'!$F$29:$F$70)))))"

--

HTH

RP
(remove nothere from the email address if mailing direct)
 

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

Back
Top