Ask Your Question

basic function to return cell contents [closed]

asked 2013-12-31 04:02:45 +0200

raymondvillain gravatar image

updated 2014-01-07 00:02:10 +0200

oweng gravatar image

Spreadsheet has many sheets. Want to write a basic function that will return the numerical value stored in a particular cell (that is in the same location) in all the sheets. Something like

Function AddFromSheet(Optional nSheet)

If IsMissing(nSheet) Then

AddFromSheet = ThisComponent.getCurrentController().getActiveSheet().$C$4


AddFromSheet = ThisComponent.getSheets().getByIndex(nSheet-1).$C$4


End Function

Obviously this doesn't work, but, in general, how does one specify (in the basic programming language) the contents of a particular cell? In the example above, cell C4 contains a real number. I want the function to return this number.

edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by Alex Kemp
close date 2015-11-16 19:17:00.659265

1 Answer

Sort by » oldest newest most voted

answered 2013-12-31 04:28:17 +0200

raymondvillain gravatar image

updated 2013-12-31 04:29:22 +0200

Just figured it out. Cell.getValue is the magic bullet:

Function AddFromSheet(Optional nSheet)

If IsMissing(nSheet) Then


AddFromSheet = Cell.getValue



AddFromSheet = Cell.getValue

EndIf End Function

edit flag offensive delete link more

Question Tools

1 follower


Asked: 2013-12-31 04:02:45 +0200

Seen: 1,919 times

Last updated: Dec 31 '13