rmoon
06-22-2015, 06:21 AM
I have been trying to code a change in a formula to sum the number of cells that match up to the current month. (If the current month is May, I want to sum Jan:May and next time I run in June, I want Jan:Jun) The current month formatted as =Month(Date of Worksheet) is found in my Table of Contents worksheet.
Here is the code I have for the worksheet that includes the sum function.
Range("O5").Select
Dim i As Integer
i = Worksheets("Table of Contents").Range("H5")
FormulaR1C1 = "=+SUM(RC[-13]:RC[-13+i])"
With Range("O5")
.Resize(5, 1).FillDown
End With
Range("O15").Select
Thanks!
Here is the code I have for the worksheet that includes the sum function.
Range("O5").Select
Dim i As Integer
i = Worksheets("Table of Contents").Range("H5")
FormulaR1C1 = "=+SUM(RC[-13]:RC[-13+i])"
With Range("O5")
.Resize(5, 1).FillDown
End With
Range("O15").Select
Thanks!