Hi all,
I'm trying to use a FOR loop to sum all Sumn's for every n-value, which is my counter. I'm not familiar enough with VB syntax to know where I'm going wrong, but if anyone could shed some light on the subject, that would be greatly appreciated.
Here's the code:
Function Temp_A(x, y, T1)
Dim n As Integer, h, Sumn(1 To 31, 1 To 41)
Pi = 3.1415926536
W = 0.3
L = 0.4
For n = 1 To 9999 Step 1
h = Sumn(x, y)
Sumn(x, y) = (1 - Cos(n * Pi)) * WorksheetFunction.Sinh(n * Pi * (W - y) / L) * Sin(n * Pi * x / L) / (n * Pi * WorksheetFunction.Sinh(n * Pi * W / L))
Sumn = Sumn(x, y) + h
Next n
Temp_A = T1 * 2 * Sumn()
End Function
____________________
Thank you!
I'm trying to use a FOR loop to sum all Sumn's for every n-value, which is my counter. I'm not familiar enough with VB syntax to know where I'm going wrong, but if anyone could shed some light on the subject, that would be greatly appreciated.
Here's the code:
Function Temp_A(x, y, T1)
Dim n As Integer, h, Sumn(1 To 31, 1 To 41)
Pi = 3.1415926536
W = 0.3
L = 0.4
For n = 1 To 9999 Step 1
h = Sumn(x, y)
Sumn(x, y) = (1 - Cos(n * Pi)) * WorksheetFunction.Sinh(n * Pi * (W - y) / L) * Sin(n * Pi * x / L) / (n * Pi * WorksheetFunction.Sinh(n * Pi * W / L))
Sumn = Sumn(x, y) + h
Next n
Temp_A = T1 * 2 * Sumn()
End Function
____________________
Thank you!