ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   HOW to show in A2 the formule used in A1 ? (https://www.excelbanter.com/excel-programming/279381-how-show-a2-formule-used-a1.html)

Thierry Fracheboud

HOW to show in A2 the formule used in A1 ?
 
Hello,
I want to show in A2 the formule used in A1, but I want that if I change the
formule in A1, the A2 show directly the new formule.
Exemple :
1) I write in A1 : =12*1000+1000 (A1 show just the result of the formule :
13'000)
2) I want that in A2 the formule : " =12*1000+1000" appear, and that if I
change the formule in A1, A2 show directly the new formule.
Thanks for help and copie of answer to :




Tom Ogilvy

HOW to show in A2 the formule used in A1 ?
 


Public function ShowFormula(rng as Range)
ShowFormula = rng(1).formula
End Sub

Put the above in a general module, not a sheet module.

in A2 put in

=ShowFormula(A1)

changing the formula in A1 would require and edit, so no reason to make the
formula volatile

--
Regards,
Tom Ogilvy

Thierry Fracheboud wrote in message
...
Hello,
I want to show in A2 the formule used in A1, but I want that if I change

the
formule in A1, the A2 show directly the new formule.
Exemple :
1) I write in A1 : =12*1000+1000 (A1 show just the result of the formule

:
13'000)
2) I want that in A2 the formule : " =12*1000+1000" appear, and that if I
change the formule in A1, A2 show directly the new formule.
Thanks for help and copie of answer to :







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

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