How my macro will work is, I input a set integers (row numbers) seperated by commas and I will split up these numbers into seperate cells.
Then, using a loop I will use the row numbers and update the rows accordingly.
Seperate input data into seperate numbers and insert them into seperate cells on first row of sheet
Sub btnResetSelected()
Dim resetRow As String
Dim i As Integer
Dim Rows As Variant
resetRow = Range("C10").Value
Rows = Split(resetRow, ",")
For i = 0 To UBound(Rows)
Cells(1, i + 1).Value = Rows(i)
Next i
End Sub
What I have now for the insertion of formula:
Dim resetRow1 As Integer
Dim resetRow2 As Integer
resetRow1 = Range("A1").Value
Range("F" & (resetRow1) & ":I" & (resetRow1)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
resetRow2 = Range ("A2").Value
Range("F" & (resetRow2) & ":I" & (resetRow2)).Formula = "=G10_Anchor+short_end_increment*(base_year-F$57)"
I do not want to hard code this for every cell just in case the user inputs a lot of seperate integers into the cell, will a loop work/help?