I’ve tried googling this, but unfortunately, the top search result was never answered, got marked as a duplicate, and was locked.
If I want a user to call this function in Calc:
=myFun(A1:A5)
What gets sent in to the Basic function?
Function myFun(range as variant)
'what is the data type of range???
End Function
Everything I try returns an error:
Function myFun(range as variant)
dim qry as variant
dim cells as variant
dim ce as variant
dim cell as variant
qry = range.queryContentCells(com.sun.star.sheet.CellFlags.VALUE)
cells = qry.getCells()
ce = cells.createEnumeration()
Dim retVal as single
Do while ce.hasMoreElements
cell = ce.NextElement
retval = retval + myConverter(cell.Value)
Loop
myFun = retVal
End Function