![]() |
Formula syntax, "Object-defined error"
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(H450000,H4<200000),50 000*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(H4200000,H4<500000),5 0000*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(H4500000,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)))))" |
Formula syntax, "Object-defined error"
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(H450000,H4<200000),50 000*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(H4200000,H4<500000),5 0000*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(H4500000,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) wrote in message oups.com... 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(H450000,H4<200000),50 000*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(H4200000,H4<500000),5 0000*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(H4500000,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)))))" |
Formula syntax, "Object-defined error"
Bless you.
|
All times are GMT +1. The time now is 05:09 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com