ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Formula assignment problem (https://www.excelbanter.com/excel-programming/372344-formula-assignment-problem.html)

Michel S.

Formula assignment problem
 
Hello !

I'm generating a spreadsheet from Access. (all in 2002)

At one point, I have the following formula to put into a cell :

xlSheet.Range(...).FormulaR1C1 = _

"IF(ISBLANK(RC[-1]),"""",IF(LEFT(RC[-1],1)=""N"",""Fail"",""Passed""))"

If I do the assignment directly in code as above, it works well. But
if I use instead :

xlSheet.Range(...).FormulaR1C1 = strFormula

where strFormula contains exactly the same formula (except for the
leading and trailing quotes), it fails with an error 1004

Any idea ?

Thanks in advance.



Michel S.

SOLVED - Formula assignment problem
 
Problem solved..

Since the formula is stored in a database field, it doesn't require the
double double quotes to indicate a double quote character.


Hello !

I'm generating a spreadsheet from Access. (all in 2002)

At one point, I have the following formula to put into a cell :

xlSheet.Range(...).FormulaR1C1 = _
"IF(ISBLANK(RC[-1]),"""",IF(LEFT(RC[-1],1)=""N"",""Fail"",""Passed""))"

If I do the assignment directly in code as above, it works well. But if I
use instead :

xlSheet.Range(...).FormulaR1C1 = strFormula

where strFormula contains exactly the same formula (except for the leading
and trailing quotes), it fails with an error 1004

Any idea ?

Thanks in advance.





All times are GMT +1. The time now is 03:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com