Formula insertion not working

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Guys

I am trying to indert a series of formulas into a new worksheet, however all
the formulas work except this one. It just skips straight over it. It looks
complicated but it is simply a lookup function. Is there anything in this
formula which would prevent the program from writing it?

Cheers
Damo

Range("F153").Select
ActiveCell.FormulaR1C1 =
"=IF(R[-2]C="""","""",IF(OR(R[-2]C=""WEG"",R[-2]C=""TECO"",R[-2]C=""TOSHIBA""),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$10:$AU$12,2,FALSE)+16,FALSE),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$3:$AU$7,2,FALSE)+16,FALSE)))"
 
When I'm debugging this kind of stuff, I'll erase that leading = (equal sign)
and run the code.

Then I'll go back to the worksheet and select that cell, add the leading equal
sign and see if there is an error.

But that doesn't help why it gets skipped over.

Any chance you wipe out that cell with something else later in code?
Guys

I am trying to indert a series of formulas into a new worksheet, however all
the formulas work except this one. It just skips straight over it. It looks
complicated but it is simply a lookup function. Is there anything in this
formula which would prevent the program from writing it?

Cheers
Damo

Range("F153").Select
ActiveCell.FormulaR1C1 =
"=IF(R[-2]C="""","""",IF(OR(R[-2]C=""WEG"",R[-2]C=""TECO"",R[-2]C=""TOSHIBA""),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$10:$AU$12,2,FALSE)+16,FALSE),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$3:$AU$7,2,FALSE)+16,FALSE)))"
 
Thanks for hte reply. No, there is nothing else in the code that erases the
sell even in stepthrough/debug mode. I will try your suggetion.

Dave Peterson said:
When I'm debugging this kind of stuff, I'll erase that leading = (equal sign)
and run the code.

Then I'll go back to the worksheet and select that cell, add the leading equal
sign and see if there is an error.

But that doesn't help why it gets skipped over.

Any chance you wipe out that cell with something else later in code?
Guys

I am trying to indert a series of formulas into a new worksheet, however all
the formulas work except this one. It just skips straight over it. It looks
complicated but it is simply a lookup function. Is there anything in this
formula which would prevent the program from writing it?

Cheers
Damo

Range("F153").Select
ActiveCell.FormulaR1C1 =
"=IF(R[-2]C="""","""",IF(OR(R[-2]C=""WEG"",R[-2]C=""TECO"",R[-2]C=""TOSHIBA""),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$10:$AU$12,2,FALSE)+16,FALSE),VLOOKUP('System
Calcs'!R[-68]C,'[MOTOR
SELECT.xls]Motors'!$AV$3:$BP$180,VLOOKUP(R[-2]C,'[MOTOR
SELECT.xls]Motors'!$AT$3:$AU$7,2,FALSE)+16,FALSE)))"
 

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