Hi - some comments…
Why not simply =COUNTA(A1:A10)
This =SUMPRODUCT(A1:A10<>"")
helps to differentiate cells containing a formula but showing no results for instance.
And =SUMPRODUCT(NOT(ISBLANK(A1:A10)))
works with the test version 5.0.0.3
But as the question is tagged Script you can do in several ways. For example, the first simple, the second allowing more detail:
dim oSheet as object, oCells as object
dim oResult
dim flag as long
oSheet = thiscomponent.sheets.getByName("Sheet1")
oCells = oSheet.getCellRangeByName("A1:A10")
msgbox "Not empty: " & oCells.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT), 64, ""
flag = com.sun.star.sheet.CellFlags.VALUE
flag = flag + com.sun.star.sheet.CellFlags.DATETIME
flag = flag + com.sun.star.sheet.CellFlags.STRING
'flag = flag + com.sun.star.sheet.CellFlags.FORMULA'
oResult = oCells.queryContentCells(flag)
if oResult.count = 0 then
msgbox "none", 64, ""
else
msgbox "Custom: " & oResult.computeFunction(com.sun.star.sheet.GeneralFunction.COUNT), 64, ""
end if
Empty.ods
Regards