Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Posts
    27

    Unanswered: 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)

  2. #2
    Join Date
    Nov 2003
    Location
    Birmingham - UK
    Posts
    1
    TRY SOMETHING LIKE THIS

    Code:
    Range("A2:B2").Formula = Range("C6:D6").Formula

  3. #3
    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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •