If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > PC based Database Applications > Microsoft Excel > Formulas changing when copying to another cell

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-02-05, 13:51
troystevens troystevens is offline
Registered User
 
Join Date: Feb 2005
Posts: 27
Formulas changing when copying to another cell

Hi,

I am trying to copy a formula from one cell to another after clearing the contents but the formula changes when I copy programatically. I want the formula to stay the same.

IE:

=IF(Sheet2!$B$20="ETO",+IF(AC43=0,"",IF(AC43>0,AC4 3,"")))

IE:

IF(Sheet2!$B$20="ETO",+IF(W42=0,"",IF(W42>0,W42,"" )))

However, the original formula that was copied stays the same but once it reaches its destination it remains the same.

Code example:

Worksheets("sheet1").Range("Ae47:Af47").Copy
Range("ae44:af44").PasteSpecial (xlPasteValues)
Worksheets("sheet1").Range("Ae45:Af46").ClearConte nts

'Changed this formula to reflect ETO calculation to mirror STOT.
Worksheets("sheet1").Range("Ak46").Copy
Range("Ae45").PasteSpecial (xlPasteFormulas)

'Take these two formulas and paste them into
'the Less Hrs Taken cells.
Worksheets("sheet1").Range("AL46:AM46").Copy
Range("Ae46:Af46").PasteSpecial (xlPasteFormulas)
Reply With Quote
  #2 (permalink)  
Old 12-03-05, 08:56
WillR WillR is offline
Registered User
 
Join Date: Nov 2003
Location: Birmingham - UK
Posts: 1
TRY SOMETHING LIKE THIS

Code:
Range("A2:B2").Formula = Range("C6:D6").Formula
Reply With Quote
  #3 (permalink)  
Old 12-03-05, 14:22
shades shades is offline
Registered User
 
Join Date: Oct 2003
Posts: 1,091
Howdy, Will. Glad to see you on the board!
__________________
old, slow, and confused
but at least I'm inconsistent!

Rich
(retired Excel 2003 user, 3/28/2008)

How to ask a question on forums
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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