Having named volt_array and coef_array in an excel workbook, the expression =SERIESSUM(INDEX(volt_array,2),0,1,INDEX(coef_array,,1)) in excel produces the expected result -.000644218.
But running
<code>Function Stuff_()
Dim wb As Workbook
Dim ws As Worksheet
Dim output As Range
Dim var as double
var = Application.WorksheetFunction.SeriesSum(Application.WorksheetFunction.Index(volt_array, 2), 0, 1, Application.WorksheetFunction.Index(coef_array, , 1))
Set wb = ActiveWorkbook
Set ws = wb.Sheets("fixed currents")
Set output = ws.Range("AB1")
output.Value = coef_array
End Function
</code>
<code>Function Stuff_()
Dim wb As Workbook
Dim ws As Worksheet
Dim output As Range
Dim var as double
var = Application.WorksheetFunction.SeriesSum(Application.WorksheetFunction.Index(volt_array, 2), 0, 1, Application.WorksheetFunction.Index(coef_array, , 1))
Set wb = ActiveWorkbook
Set ws = wb.Sheets("fixed currents")
Set output = ws.Range("AB1")
output.Value = coef_array
End Function
</code>
Function Stuff_()
Dim wb As Workbook
Dim ws As Worksheet
Dim output As Range
Dim var as double
var = Application.WorksheetFunction.SeriesSum(Application.WorksheetFunction.Index(volt_array, 2), 0, 1, Application.WorksheetFunction.Index(coef_array, , 1))
Set wb = ActiveWorkbook
Set ws = wb.Sheets("fixed currents")
Set output = ws.Range("AB1")
output.Value = coef_array
End Function
throws on the var = statement the error
<code>Compile error: Argument not optional
</code>
<code>Compile error: Argument not optional
</code>
Compile error: Argument not optional
What am I doing wrong?
I expect the same results when I run the SERIESSUM statement in excel and in vba.
2