VBA code to update formulas every month

rperez

New Member
Joined
Jun 14, 2015
Messages
1
Hi,
I have a workbook which I updated every month with a new row of data. There are rolling trends calculated which need to be updated as well.

In January, the trend formula is as follows : =(SUM(E15:E26)/SUM(D15:D26))/(SUM(E3:E14)/SUM(D3:D14))

The next month, the formulas are shifted down one row. For example in February, the formula reads:

=(SUM(E16:E27)/SUM(D16:D27))/(SUM(E4:E15)/SUM(D4:D15))

The formulas move down one row every month in this manner until January where the formulas are reset to the first formula.

I have been updating the formulas by dragging down the reference boxes for the four ranges, but there are 5 trends calculated on each sheet, with 8 sheets in the entire workbook. The process can get tedious. The locations of the formulas and the ranges also differ from sheet to sheet, so they can't be grouped. I came up with a long sum offset formula to achieve the same result, but was told the formulas need to stay the same in the work book. Is there any way to automate this process with a VBA code?

Any help or direction would be greatly appreciated!


<tbody>
</tbody>
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,203,605
Messages
6,056,254
Members
444,853
Latest member
sam69

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top