ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   formula after running a macro (https://www.excelbanter.com/excel-programming/353016-formula-after-running-macro.html)

Shira

formula after running a macro
 
I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.

ben

formula after running a macro
 
without seeing your code my guess is you are populating the cells with the
values rather than the formuals eg....

MySum = application.worksheetfunction.sum("A1:A10")
Range("a11") = MySum

it should be

range("a11") = "=Sum("""A1:A10""")"

this will populate a formula into the cell and not just a value



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.


ben

formula after running a macro
 
sorry for the quotes the formula should be

range("a11") = "=Sum(A1:A10)"



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"ben" wrote:

without seeing your code my guess is you are populating the cells with the
values rather than the formuals eg....

MySum = application.worksheetfunction.sum("A1:A10")
Range("a11") = MySum

it should be

range("a11") = "=Sum("""A1:A10""")"

this will populate a formula into the cell and not just a value



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.


Shira

formula after running a macro
 
Thanks for the reply

in fact this is what i am doing:
inside a loop:

clicks = clicks + Range("f" & CStr(i))
and after exiting the loop:
Range("f" & CStr(row + 1)) = clicks

"ben" wrote:

sorry for the quotes the formula should be

range("a11") = "=Sum(A1:A10)"



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"ben" wrote:

without seeing your code my guess is you are populating the cells with the
values rather than the formuals eg....

MySum = application.worksheetfunction.sum("A1:A10")
Range("a11") = MySum

it should be

range("a11") = "=Sum("""A1:A10""")"

this will populate a formula into the cell and not just a value



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.


ben

formula after running a macro
 
hmmm

range("f" & row+1) = "=Sum(F" & LowestRow & ":f" & HighestRow & ")"
use lowest/highest row to determine start and stop point and use above line
outside of code

--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

Thanks for the reply

in fact this is what i am doing:
inside a loop:

clicks = clicks + Range("f" & CStr(i))
and after exiting the loop:
Range("f" & CStr(row + 1)) = clicks

"ben" wrote:

sorry for the quotes the formula should be

range("a11") = "=Sum(A1:A10)"



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"ben" wrote:

without seeing your code my guess is you are populating the cells with the
values rather than the formuals eg....

MySum = application.worksheetfunction.sum("A1:A10")
Range("a11") = MySum

it should be

range("a11") = "=Sum("""A1:A10""")"

this will populate a formula into the cell and not just a value



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.


Shira

formula after running a macro
 
thank you

"ben" wrote:

hmmm

range("f" & row+1) = "=Sum(F" & LowestRow & ":f" & HighestRow & ")"
use lowest/highest row to determine start and stop point and use above line
outside of code

--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

Thanks for the reply

in fact this is what i am doing:
inside a loop:

clicks = clicks + Range("f" & CStr(i))
and after exiting the loop:
Range("f" & CStr(row + 1)) = clicks

"ben" wrote:

sorry for the quotes the formula should be

range("a11") = "=Sum(A1:A10)"



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"ben" wrote:

without seeing your code my guess is you are populating the cells with the
values rather than the formuals eg....

MySum = application.worksheetfunction.sum("A1:A10")
Range("a11") = MySum

it should be

range("a11") = "=Sum("""A1:A10""")"

this will populate a formula into the cell and not just a value



--
When you lose your mind, you free your life.
Ever Notice how we use '' for comments in our posts even if they aren''t
expected to go into the code?


"SHIRA" wrote:

I have built a macro that is reading raw data and create a report from the
data,the report is great but the formula aren't shown in the end report.

for example:

if in my macro i have made a sum of different fields the result in the
report is a number without the formula.

there is a way to see the embedded formula after running the macro.



All times are GMT +1. The time now is 04:58 PM.

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