D
david2004
Hi all
This is my 1st post.I am really new in VBA . Need help from all.
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 wish to create a click() function such that the macro will be
activated automatically when the user click on the assigned button. The
formula will be called by the sub function.But i am not sure at all how
it should be done.
The calculated values will then appear in a created table in a
particular column.
Pls help. Urgent!. Thx
This is my 1st post.I am really new in VBA . Need help from all.
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 wish to create a click() function such that the macro will be
activated automatically when the user click on the assigned button. The
formula will be called by the sub function.But i am not sure at all how
it should be done.
The calculated values will then appear in a created table in a
particular column.
Pls help. Urgent!. Thx