+ Reply to Thread
Results 1 to 3 of 3

Thread: Macro to copy formula and add it to another formula

  1. #1
    Registered User
    Join Date
    10-23-2010
    Location
    Denver
    MS-Off Ver
    Excel 2003
    Posts
    3

    Macro to copy formula and add it to another formula

    I'm looking to find or write a macro that takes the formula in an existing cell, pulls the formula from another cell and adds the two together. For example: in cell r3c7 I have formulaA, I want the macro to return FormalaA + FormulaB (which exists in cell r3a3). without altering the contents in r3a3. Then I need this to repeat for each cell withing the given range. Another option is to have this macro return FormulaA + r3a3, as long as r3a3 remains a variable value that will change as the formula in r3a3 returns different results.

  2. #2
    Forum Guru snb's Avatar
    Join Date
    05-09-2010
    Location
    VBA
    MS-Off Ver
    Redhat
    Posts
    5,151

    Re: Macro to copy formula and add it to another formula

    cells(1,3).formula=cells(1,1).formula & "+" & cells(1,2).formula



  3. #3
    Forum Guru Marcol's Avatar
    Join Date
    12-23-2009
    Location
    Fife, Scotland
    MS-Off Ver
    Excel '97 & 2003/7
    Posts
    5,590

    Re: Macro to copy formula and add it to another formula

    You might want to remove the extra = operator

    Cells(1, 3).Formula = Cells(1, 1).Formula & "+" & Right(Cells(1, 2).Formula, Len(Cells(1, 2).Formula) - 1)

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.2.0