ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help with syntax (https://www.excelbanter.com/excel-programming/352418-help-syntax.html)

anny

help with syntax
 
hi

This code gives an error (Application-defined or Object-defined error).

Worksheets("PrintRpts").Range("O8").Formula = "=IF(E8<"",E8,-1)"

But, when I type =IF(E8<"",E8,-1) directly into O8, I get the
expected result. Any ideas where the problem is?

Thanks a bunch
anny



JMB

help with syntax
 
You need another pair of quotes.

Worksheets("PrintRpts").Range("O8").Formula = "=IF(E8<"""",E8,-1)"


"anny" wrote:

hi

This code gives an error (Application-defined or Object-defined error).

Worksheets("PrintRpts").Range("O8").Formula = "=IF(E8<"",E8,-1)"

But, when I type =IF(E8<"",E8,-1) directly into O8, I get the
expected result. Any ideas where the problem is?

Thanks a bunch
anny




anny

help with syntax
 
Works beautyfully!
anny




All times are GMT +1. The time now is 12:17 AM.

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