Property or method not found; currentcontroller
I ok past the error message page shows and I have to force recalc and it works.
Code: Select all
REM Usage is Function AddIfColor("a1:a23") note quotes around designated range
Function AddIfColor(oRange as string)AS Double
dim oCell
colorred = rgb(255,0,0)
AddIfColor = 0
sheet=thiscomponent.currentcontroller.activesheet
rangeaddress = sheet.getCellRangeByName(oRange).getrangeaddress
with rangeaddress
for col=.startcolumn to .endcolum
for row = .startrow to .endrow
oCell=sheet.getCellByPosition (col,row)
if oCell.charcolor = colorred then
AddIfColor =AddIfColor + ocell.value
end if
next
next
end with
End Function