ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Pasting formula as text (https://www.excelbanter.com/excel-programming/325375-pasting-formula-text.html)

ExcelMonkey[_190_]

Pasting formula as text
 
I am trying to past the formula from a cell into another
cell as text. That is if cell A1 has a formula which is
=Sum(A2:A10). I want to be able to past the text version
of this to say B1. So B1 will say 'Sum(A2:A10). How do
you do this?

I have been trying:

Range("B1") = Range("A1").formula

But this is not giving me what I want.

THanks

Trevor Shuttleworth

Pasting formula as text
 
ExcelMonkey

one way:

Range("B1") = "'" & Range("A1").Formula

Regards

Trevor


"ExcelMonkey" wrote in message
...
I am trying to past the formula from a cell into another
cell as text. That is if cell A1 has a formula which is
=Sum(A2:A10). I want to be able to past the text version
of this to say B1. So B1 will say 'Sum(A2:A10). How do
you do this?

I have been trying:

Range("B1") = Range("A1").formula

But this is not giving me what I want.

THanks




Rowan[_2_]

Pasting formula as text
 
Or

Range("B1").Value = Right(Range("A1").Formula, Len(Range("A1").Formula) - 1)



"ExcelMonkey" wrote:

I am trying to past the formula from a cell into another
cell as text. That is if cell A1 has a formula which is
=Sum(A2:A10). I want to be able to past the text version
of this to say B1. So B1 will say 'Sum(A2:A10). How do
you do this?

I have been trying:

Range("B1") = Range("A1").formula

But this is not giving me what I want.

THanks


ExcelMonkey[_190_]

Pasting formula as text
 
Thanks


-----Original Message-----
ExcelMonkey

one way:

Range("B1") = "'" & Range("A1").Formula

Regards

Trevor


"ExcelMonkey"

wrote in message
...
I am trying to past the formula from a cell into another
cell as text. That is if cell A1 has a formula which

is
=Sum(A2:A10). I want to be able to past the text

version
of this to say B1. So B1 will say 'Sum(A2:A10). How do
you do this?

I have been trying:

Range("B1") = Range("A1").formula

But this is not giving me what I want.

THanks



.



All times are GMT +1. The time now is 01:58 AM.

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