Someone help me using Excel VBAProject to write a formula:
Function mySum(firstCell As Range, interval As Integer, lastCell As Range)
temp = 0
For i = firstCell.Row To lastCell.Row Step interval
temp = temp + Cells(i, firstCell.Column)
Next i
mySum = temp
End Function
This is formula under Module1.
End line of Excel sheet, I enter :" mySum(c5,9,c275)".
Because I want adding every nine line number togather ( example = c5+c14+c23+c32 ... until to +c275 ).
Now this formaula is working. but problem is -- this formula can not auto update, this mean that every time I change or add new number, it can not sum and make new sum ( still keep old sum number ). I have to re-enter " mySum(c5,9,c275)" and enter, then new sum came out.
I don't know what is wrong? I don't know how to fix this problem ?
It shall auto update by that formula.
Someone told me I need setup run macro into module1.
I don't know how to do this let run macro into module1 ?