Hi,
short question: Is there a way to pass the current value of a cell into a user function, run some calculations, and then change that same cell (without using activecell)?
Longer explanation:
I've got a macro which I'm running to recalculate every few minutes or so as data changes. The macro is calculating the moving average, so it takes the previous moving average, and then takes the new value, and uses those two items plus the time interval to calculate a new moving avg.
Anyway, instead of recalculating the spreadsheet through a macro, I thought a user function would be better.
I started with this:
Function dmvavg(interval As Single, num As Single) As Double
Dim spec As Single
spec = dmvavg
spec = (num * (1 / interval)) + (spec * (1 - 1 / interval))
dmvavg = (num * (1 / interval)) + (spec * (1 - 1 / interval))
End Function
Thanks for any help.
Bookmarks