ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Copying exact formula from one worksheet to another within a macro (https://www.excelbanter.com/excel-programming/425099-copying-exact-formula-one-worksheet-another-within-macro.html)

Eric_G

Copying exact formula from one worksheet to another within a macro
 
I have a very complicated cell formula stored in a particular cell of a
worksheet. I wish to copy the formula EXACTLY AS IT IS STORED in Cell A1 of
worksheet A to Cell BB1 of worksheet 2, but to do so within a macro. When I
attempt to copy the formula within the macro, it makes a number of changes to
the contents upon copying the cell. All I want to do is actually copy the
exact syntax of the formula which has no relevance to the cell in which it is
actually stored -- I just store it there because I don't want to loose the
syntax. It's quite complicated so attempting to create it in VBA is too
complicated.

Any suggestions?

Gary''s Student

Copying exact formula from one worksheet to another within a macro
 
Sub ericg()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s2.Range("BB1").Formula = s1.Range("A1").Formula
End Sub
--
Gary''s Student - gsnu200836


"Eric_G" wrote:

I have a very complicated cell formula stored in a particular cell of a
worksheet. I wish to copy the formula EXACTLY AS IT IS STORED in Cell A1 of
worksheet A to Cell BB1 of worksheet 2, but to do so within a macro. When I
attempt to copy the formula within the macro, it makes a number of changes to
the contents upon copying the cell. All I want to do is actually copy the
exact syntax of the formula which has no relevance to the cell in which it is
actually stored -- I just store it there because I don't want to loose the
syntax. It's quite complicated so attempting to create it in VBA is too
complicated.

Any suggestions?


Eric_G

Copying exact formula from one worksheet to another within a m
 
That's it -- many thanks.

"Gary''s Student" wrote:

Sub ericg()
Set s1 = Sheets("Sheet1")
Set s2 = Sheets("Sheet2")
s2.Range("BB1").Formula = s1.Range("A1").Formula
End Sub
--
Gary''s Student - gsnu200836


"Eric_G" wrote:

I have a very complicated cell formula stored in a particular cell of a
worksheet. I wish to copy the formula EXACTLY AS IT IS STORED in Cell A1 of
worksheet A to Cell BB1 of worksheet 2, but to do so within a macro. When I
attempt to copy the formula within the macro, it makes a number of changes to
the contents upon copying the cell. All I want to do is actually copy the
exact syntax of the formula which has no relevance to the cell in which it is
actually stored -- I just store it there because I don't want to loose the
syntax. It's quite complicated so attempting to create it in VBA is too
complicated.

Any suggestions?


JLGWhiz

Copying exact formula from one worksheet to another within a macro
 
The only reason that I can think of that it would change when copied is that
some row and column references might be in relative reference format. Change
them to absolute reference format and see if it changes.

"Eric_G" wrote:

I have a very complicated cell formula stored in a particular cell of a
worksheet. I wish to copy the formula EXACTLY AS IT IS STORED in Cell A1 of
worksheet A to Cell BB1 of worksheet 2, but to do so within a macro. When I
attempt to copy the formula within the macro, it makes a number of changes to
the contents upon copying the cell. All I want to do is actually copy the
exact syntax of the formula which has no relevance to the cell in which it is
actually stored -- I just store it there because I don't want to loose the
syntax. It's quite complicated so attempting to create it in VBA is too
complicated.

Any suggestions?



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

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