ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Run Time Error 1004 - Application-defined or object-defined error (https://www.excelbanter.com/excel-programming/341738-run-time-error-1004-application-defined-object-defined-error.html)

Brent

Run Time Error 1004 - Application-defined or object-defined error
 
Can someone tell me why this formula gives me a run time eror?
Range("E2").Formula = "=IF( AND( NOT(G2),
NOT(ISBLANK(B2)),NOT(ISBLANK(I2))),TODAY()-I2,"" )"

or why this also gives the same error?
Range("E2").Formula = "=IF(G2,I2,"")"


K Dales[_2_]

Run Time Error 1004 - Application-defined or object-defined error
 
Quotes inside quotes. Try this in the immediate pane:
? "=IF(G2,I2,"")"
you should get
=IF(G2,I2,")
which is an invalid formula and therefore the error. Solution is to use ""
wherever you want ", so """" for "":
Range("E2").Formula="=IF(G2,I2,"""")"
and similarly for your other formula
--
- K Dales


"brent" wrote:

Can someone tell me why this formula gives me a run time eror?
Range("E2").Formula = "=IF( AND( NOT(G2),
NOT(ISBLANK(B2)),NOT(ISBLANK(I2))),TODAY()-I2,"" )"

or why this also gives the same error?
Range("E2").Formula = "=IF(G2,I2,"")"


Tom Ogilvy

Run Time Error 1004 - Application-defined or object-defined error
 
Range("E2").Formula = "=IF(G2,I2,"""")"

do the same for your other formula.

double quotes within quotes

--
Regards,
Tom Ogilvy

"brent" wrote in message
...
Can someone tell me why this formula gives me a run time eror?
Range("E2").Formula = "=IF( AND( NOT(G2),
NOT(ISBLANK(B2)),NOT(ISBLANK(I2))),TODAY()-I2,"" )"

or why this also gives the same error?
Range("E2").Formula = "=IF(G2,I2,"")"





All times are GMT +1. The time now is 04:40 AM.

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