The only thing I might do differently would be to put in a Function procedure (aka UDF) rather than a Sub procedure. You could then either hard code the constants and n as above, or pass those values to the function as arguments. You could also put the function output wherever you want. It would make it a little more flexible. Because it is used like built in functions, it also fits into Excel's calculation sequence so that it will recalculate automatically (assuming calculation is set to automatic).
Function sumseries(pi,z,L,k,t,n)
sumseries=0
For i=1 to n
sumseries=sumseries+f(i)
Next i
end function
You would then call the function from a spreadsheet cell as =sumseries(a1,a2,a3,...).
Bookmarks