+ Reply to Thread
Results 1 to 4 of 4

code to add formulas to a range with previous formulas appearing inside the new one

  1. #1
    Registered User
    Join Date
    04-15-2010
    Location
    India
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010 and Excel 2013
    Posts
    22

    code to add formulas to a range with previous formulas appearing inside the new one

    I often come across a situation where I want to add a formula to a range (let’s say an extra restriction, like an ‘IF’ formula), but since the range has many other formulas, I have to basically go 1 by 1 changing the range (cell by cell, column by column or row by row).


    Is there a code to add formulas to a range so the previous formulas appear inside the new added formula?


    If not, can someone help me creating a macro for the same?


    Of course this has some limitations and considerations that must be taken into account:



    · The new formula should be dynamic and obey to the ‘$’ restrictions (e.g. $A$1 means the cell is fixed, $A1 means the column is fixed, but the row is mobile, etc).

    · Formulas can have 1 extra parameter or several extra parameters (e.g. Vlookup has 3 new parameters, the reference table, the column number and the “False” parameter, whereas left has only 1 extra field).

    · In case the range to modify contains an array, then it would be useful if it keeps it that way.


    Thanks in advance.

    Regards,
    Excelorator

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: code to add formulas to a range with previous formulas appearing inside the new o

    Hi Excel-o-ratoR

    You can use the bulid-in find and replace with the "formula option" to modify your formulae
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    04-15-2010
    Location
    India
    MS-Off Ver
    Excel 2003, Excel 2007, Excel 2010 and Excel 2013
    Posts
    22

    Re: code to add formulas to a range with previous formulas appearing inside the new o

    Thanks for the advise Pike. However, I cannot use Find/Replace as I have different formulas in the whole range. So using Find/Replace is as good as going to each cell in the range and changing the formula.

  4. #4
    Forum Guru
    Join Date
    08-26-2007
    Location
    London
    Posts
    4,606

    Re: code to add formulas to a range with previous formulas appearing inside the new o

    I think you need to give us specific details of what needs doing. I don't think one could write code to cater for changes to any formula at all.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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.6.0 RC 1