VBA - changing references for formula based on a given criteria

bob1987

New Member
Joined
Jul 18, 2017
Messages
1
Dear All,
I am struggling with this issue for a while.
I have to build a macro that changes formulas references according to a given set of criteria (basically moving the reference if it refers to external factor and staying at the previous year if it internal)
ABCDEFGHI
1Typename201620172018201920202021
2externalprice10010195987858
3internaldiscount5542-1-5
4internalvolume101110,5111011
5
6formula=(C2-C3)*C4=(C2-D3)*D4=(D2-E3)*E4=(E2-F3)*F4=(F2-G3)*G4=(G2-H3)*H4
7

<tbody>
</tbody>

Unfortunately there are no standard formulas that are calculated.
I would like only to insert the first formula (in C6) and then build a macro that extend it. I know that it is possible but I cannot get around it :(:(
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,214,912
Messages
6,122,200
Members
449,072
Latest member
DW Draft

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