Run-time error '1004': Application-defined or object-defined error

eoinymc

Board Regular
Joined
Jan 29, 2009
Messages
203
Hi,

I am receiving the above error when trying to process this line of code:

FinalRow = 20

Cells(4, 18).Resize(FinalRow - 3, 1).Formula = _
"=IF(ISNA(IF(($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0))))>(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))),($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0)))),(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))))),"",IF(($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0))))>(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))),($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0)))),(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0)))))"


I know it's a generic error.

It works if I take out the If(isna(...) part of the function...and it also works if I paste the above formula directly into the cell.

Do you think it could be got to do with the fact that I'm trying to populate more than 1 row (FinalRow variable) here?

Any help would be greatly appreciated.

Cheers,

Eoin
 

Excel Facts

Can a formula spear through sheets?
Use =SUM(January:December!E7) to sum E7 on all of the sheets from January through December
when you enter a formula in a cell with VBA
AND that formula contains Quotes, you need to double up those quotes.

Try
Rich (BB code):
Cells(4, 18).Resize(FinalRow - 3, 1).Formula = _
"=IF(ISNA(IF(($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0))))>(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))),($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$A O$4,0)))),(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))))),"""",IF(($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$AO$4,0))))>(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0))),($P4*(INDEX(Handling!$C$8:$AO$8,MATCH($D4,Handling!$C$4:$A O$4,0)))),(INDEX(Handling!$C$7:$AO$7,MATCH($D4,Handling!$C$4:$AO$4,0)))))"

Hope that helps.
 
Upvote 0

Forum statistics

Threads
1,224,574
Messages
6,179,633
Members
452,933
Latest member
patv

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top