ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Complie error: Expected: end of statement (https://www.excelbanter.com/excel-programming/430288-complie-error-expected-end-statement.html)

diepvic

Complie error: Expected: end of statement
 

Hi,
I've got a macro code as below:
Range("A1").FormulaArray = _
"=if(B1="Loan",D1,0)"

And it causes a compile error. How should I fix it if I want to keep the
text Loan in my formula.

Thanks so much

Mike H

Complie error: Expected: end of statement
 

Hi,

Firstly it's not an array formula and so no need for FormulaArray and second
double up on the quotes to solve your problem

Range("A1").Formula = "=if(B1=""Loan"",D1,0)"

Mike

"diepvic" wrote:

Hi,
I've got a macro code as below:
Range("A1").FormulaArray = _
"=if(B1="Loan",D1,0)"

And it causes a compile error. How should I fix it if I want to keep the
text Loan in my formula.

Thanks so much



All times are GMT +1. The time now is 03:00 AM.

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