well, right now you are reseting the varible "a" to a new number everytime your loop runs.
you need to add the value to a, here's how i would do it.
Function product(ByVal n As Double, ByRef i As Double)
Dim a As Double
a = 0
for i = 1 To n
a = a + (i*n)
Next
Return a
End Function
not sure if that's what you are looking for. Also, this looks like homework....please don't let it be homework, mainly because posting homework questions is against the forum rules.