Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default 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)))))"

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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)))))"



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 23
Default Formula syntax, "Object-defined error"

Bless you.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
correct syntax for nesting "if", "and", and "vlookup"....if possib Christine Excel Worksheet Functions 4 January 2nd 09 10:43 PM
Adding "And" clause in SQL string causing SQL Syntax error Android[_2_] Excel Programming 3 July 8th 04 09:36 PM
What does "Application-defined or object-defined error" mean? Shatin Excel Programming 4 February 3rd 04 10:15 AM
"Application-defined or object-defined error" while printing excel report chemburkar Excel Programming 0 February 2nd 04 08:33 PM
"Run Time Error 1004 Application Defined or Object Defined Error." BJC Excel Programming 4 October 26th 03 03:09 AM


All times are GMT +1. The time now is 06:25 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"