title: Use code to modify Excel formulas
body: <p>I have an Excel 2010 workbook with 22 worksheets in it.  The first worksheet is labeled DATA, where data is entered by a user.  Row A1-N1 contain labels.  Rows A2-A18 contains data for January 2015 for the 17 locations beginning as cell A2, i.e. row 2 contains data for location 1, row 3 for location 3, etc.  February data begins at row 19, March begins at row 36, etc.</p>
  
  <p>On each worksheet A1-M1 are labels and rows 2-13 are the months January - December.  Cell B2 on worksheet #2 references cell J2 on the worksheet DATA.  The other formulas on row 2 of worksheet #2 reference cells on row 2 on worksheet DATA.  Row 3 of worksheet #2 references cells on row 19 of DATA.  In column N of each location worksheet has a number in cell N2 that corresponds to the appliable row on the worksheet DATA.</p>
  
  <p>Here is an example of one of my formulas:</p>
  
  <blockquote>
    <p>=(IF(ISBLANK(DATA!D2),"-",IF(ISERROR(DATA!E2/DATA!D2),"N/A",(DATA!E2/DATA!D2)))).</p>
  </blockquote>
  
  <p>I would like to have VB code, or a macro?, that would edit every formula on each worksheet by replacing the current number in the formula with the number in column N of that same row, i.e. if N7 contained the number 88 the code would alter any formula on that row by removing the current number in the formula and replacing with the number 88.</p>
  
  <p><strong>Additional information:</strong> </p>
  
  <p>On each worksheet there are different formulas for columns B-M.  The code would need to take the number in column N for that row and replace whatever number is in that formula with the number in column N of that row, for each row, for each worksheet.</p>
  
  <p>Currently, I have to touch each formula on every worksheet and this is too time consuming.  Beginning in April the locations will increase from 17 to 148 which will require coding to make the appropriate changes.</p>
  
  <p>DATA worksheet image </p>
  
  <p><img src="https://imgur.com/AP6M1G1.png" alt=""></p>
  
  <p>1R location worksheet image </p>
  
  <p><img src="https://imgur.com/9AcDGn0.png" alt=""></p>