ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel Formulas Treated as Strings (https://www.excelbanter.com/excel-programming/417978-excel-formulas-treated-strings.html)

cjes

Excel Formulas Treated as Strings
 
I am trying to create a formula through code.

I am managing to do this but in the actual cell the formula is not being
calculated. It is being treated as text.
Ex.
In cell B1 i have a value of 500
I want to create a formula showing 500 *5 in cell b2.

in cell b2 I am calling a function ChgVal(B1). The result in B2 is correctly
showing =500*5 but it is not showing the value 2500.
I also tried using the VALUE command but to no avail.
Can anyone pls help?
Thanks


joel

Excel Formulas Treated as Strings
 
Range("B2").formula = "=5*Chgval(B1)"

"cjes" wrote:

I am trying to create a formula through code.

I am managing to do this but in the actual cell the formula is not being
calculated. It is being treated as text.
Ex.
In cell B1 i have a value of 500
I want to create a formula showing 500 *5 in cell b2.

in cell b2 I am calling a function ChgVal(B1). The result in B2 is correctly
showing =500*5 but it is not showing the value 2500.
I also tried using the VALUE command but to no avail.
Can anyone pls help?
Thanks



All times are GMT +1. The time now is 12:19 PM.

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