ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Macro Showing Formula and Result (https://www.excelbanter.com/excel-programming/353112-macro-showing-formula-result.html)

Simon

Macro Showing Formula and Result
 
Hi All,

I'm very new to writing Macro's in excel, what I want to know is If I have
a macro which tells excel that Cell A1 = Cell A2 * Cell A3. Then is it
possible that once the macro executes that the result is shown in cell A1 and
if you click on cell A1 you can also see the formula i.e =A2*A3, rather than
just being able to see the result which is how it is at the moment.

Thanks.
Simon

Tom Ogilvy

Macro Showing Formula and Result
 
Range("A1").Formula = "=A2*A3"


--
Regards,
Tom Ogilvy

"Simon" wrote in message
...
Hi All,

I'm very new to writing Macro's in excel, what I want to know is If I

have
a macro which tells excel that Cell A1 = Cell A2 * Cell A3. Then is it
possible that once the macro executes that the result is shown in cell A1

and
if you click on cell A1 you can also see the formula i.e =A2*A3, rather

than
just being able to see the result which is how it is at the moment.

Thanks.
Simon




Jim Thomlinson[_5_]

Macro Showing Formula and Result
 
What you want to do is not possible (if I understand the question correctly).
Your macro pastes the value of the product of Cells A2 and A3 into A1. If A2
is 2 and A3 is 3 then your macro puts the number 6 into Cell A1. This is just
a number and cell A1 has no idea how that number got in there. Tom's solution
is the best idea in that instead of the 6 into A1 it puts the formula into A1
which gives you what you need.
--
HTH...

Jim Thomlinson


"Simon" wrote:

Hi All,

I'm very new to writing Macro's in excel, what I want to know is If I have
a macro which tells excel that Cell A1 = Cell A2 * Cell A3. Then is it
possible that once the macro executes that the result is shown in cell A1 and
if you click on cell A1 you can also see the formula i.e =A2*A3, rather than
just being able to see the result which is how it is at the moment.

Thanks.
Simon



All times are GMT +1. The time now is 07:09 AM.

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