Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default 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?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 41
Default 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?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default 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?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Worksheet formula incorrect after copying to another worksheet Karen Excel Worksheet Functions 2 November 12th 09 01:06 AM
Copying worksheet with macro Janelle S[_2_] Excel Discussion (Misc queries) 2 November 2nd 08 10:38 PM
How do I keep the exact existing formula when drag copying? Excelchallenged Excel Discussion (Misc queries) 2 October 19th 06 10:08 PM
copying the exact contents of cells Paul Excel Programming 1 April 22nd 06 09:08 AM
Excel 2002 Copying Exact formulas Kinjalip Excel Discussion (Misc queries) 4 April 27th 05 12:10 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"