ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set formula as variable w/o "=" sign (https://www.excelbanter.com/excel-programming/399843-set-formula-variable-w-o-%3D-sign.html)

StephanieH

Set formula as variable w/o "=" sign
 
I have the following formula in my cell
=AVERAGE(OFFSET(C15,-3,0,-12,1))

I want to set a variable as the formula, such as
MyFormula = ActiveCell.Formula

How can I get rid of the "=" sign at the beginning? I basically need to add
a condition to the beginning and end of the formula and don't want the "="
inserted in the middle.

Jon Peltier

Set formula as variable w/o "=" sign
 
MyFormula = Mid$(ActiveCell.Formula, 2)

- Jon
-------
Jon Peltier, Microsoft Excel MVP
Tutorials and Custom Solutions
Peltier Technical Services, Inc. - http://PeltierTech.com
_______


"StephanieH" wrote in message
...
I have the following formula in my cell
=AVERAGE(OFFSET(C15,-3,0,-12,1))

I want to set a variable as the formula, such as
MyFormula = ActiveCell.Formula

How can I get rid of the "=" sign at the beginning? I basically need to
add
a condition to the beginning and end of the formula and don't want the "="
inserted in the middle.




Bernie Deitrick

Set formula as variable w/o "=" sign
 
Stephanie,

MyFormula = Mid(ActiveCell.Formula, 2, Len(ActiveCell.Formula))

HTH,
Bernie
MS Excel MVP


"StephanieH" wrote in message
...
I have the following formula in my cell
=AVERAGE(OFFSET(C15,-3,0,-12,1))

I want to set a variable as the formula, such as
MyFormula = ActiveCell.Formula

How can I get rid of the "=" sign at the beginning? I basically need to add
a condition to the beginning and end of the formula and don't want the "="
inserted in the middle.





All times are GMT +1. The time now is 01:11 PM.

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