Newbie needs help in VBA

D

david2004

Code:

Option Base 1
Function ABN(n, npoint)
Dim Temp(2)
Sum = 0
sum1 = 0
alpha = 2# * 3.141592654 / npoint
For j = 1 To npoint
ang = alpha * (j - 1)
Sum = Sum + Cells(6 + j, 4) * Cos(n * ang)
sum2 = sum2 + Cells(6 + j, 4) * Sin(n * ang)
Next j
Temp(1) = Sum * 2# / npoint
Temp(2) = sum2 * 2# / npoint
If n = 0 Then Temp(1) = Temp(1) / 2
ABN = Temp
End Function

If i want to create a click() function to calculate temp
(1) and temp(2) and place the results in a table.. How do
i go about using a sub function to call a function.

All the user needs to do is to input the value of n and
npoint, and click on the button and the values will be
calculated automatically and placed in a particular
column in the table

Urgent!! pls help. thx
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top