ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Newbie needs help in VBA (https://www.excelbanter.com/excel-programming/287283-newbie-needs-help-vba.html)

david2004

Newbie needs help in VBA
 
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


All times are GMT +1. The time now is 02:15 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com