|I can not download your spreadsheet at work, so I'm going off of memory here.|
This code will fire when you enter your Duration in K2. It will delete everything below C6:E6, leaving 3 months to use as the autofill criteria. It will then autofill Column C:E based on the Duration value in K2.
It does not do anything about writing the other formulas that are currently in Rows 35 and 37 since, frankly, I don't remember what they are.
If you'll tell me what those formulas are and where you want them placed, I can see about modifying the code to have them end up where you want.
Another option is to place them at the top of sheet, outside of Column C:E so that they are not impacted by the deletion and additon of the Rows.
If you used a Named range for e.g. Column E, you could use somthing like
=SUM(myColumnE) to sum all the values in Column E regardless of how many Rows contained data.
I suggest you try this in a backup copy of your workbook since macros cannot be undone.
1 - Right click the sheet tab for the sheet you are working with.
2 - Paste this code into the pane that opens.
3 - Enter a number in K2
Private Sub Worksheet_Change(ByVal Target As Range)
'Determine if change was made to K2
If Target.Address = "$K$2" Then
'Find last Row with data in Column B
lastRw = Range("C" & Rows.Count).End(xlUp).Row
'Delete B:D cells, leaving 3 months to use as AutoFill
Range("C7:E" & lastRw).Delete shift:=xlUp
'get number of months from K2
numMonths = Range("K2")
'AutoFill Columns B:D based on value in K2
Range("C4:E6").AutoFill Destination:=Range("C4:E" & numMonths + 3), _
Click Here Before Posting Data or VBA Code ---> How To Post Data or Code.