VBA to shift formula reference down one row

Ahulika

New Member
Joined
May 4, 2017
Messages
3
Hey! First time poster here - still getting used to VBA :)

I'm currently having an issue shifting formula reference down one row for a more involved formula. Currently, what I am using works great for simpe formulas, but I can't get it to work for more complex formulas.

Ex, I need to update =((C235-C229)/C229)*100 to read =((C236-C230)/C230)*100

This is what I'm running currently:

Private Sub CommandButton1_Click()
With Range("c1065")
.Formula = "=SUM(" & .DirectPrecedents.Offset(1).Address(0, 0) & ")"
End With
End Sub

However, with this formula: =((C235-C229)/C229)*100 it doesn't work.


Any help is much appreciated!
 

Excel Facts

Last used cell?
Press Ctrl+End to move to what Excel thinks is the last used cell.
Cant you just copy it down?

No, (and I probably should have mentioned this earlier) the cell below contains a similar formula. All cells are linked to other worksheets and charts, so I need the cell to stay the same, and just update the formula down one row - when I update the data.
 
Upvote 0

Forum statistics

Threads
1,215,597
Messages
6,125,738
Members
449,255
Latest member
whatdoido

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