Ask Your Question

Reference a Cell Value from a Function [closed]

asked 2013-05-16 21:32:51 +0100

slowpoison gravatar image

Is it possible to reference the value of a fixed cell from a function that I'm defining?

For example:

Function MyFunc(a) As Double
   MyFunc = a * A2
End Function
edit retag flag offensive reopen merge delete

Closed for the following reason question is not relevant or outdated by Alex Kemp
close date 2015-11-02 03:46:06.972863


The cell A2 from which sheet? From the active sheet? Then the function will return different results depending on what kind of sheet now is active. You can pass in the function more than one parameter - the second parameter specify the address of the cell A2

JohnSUN gravatar imageJohnSUN ( 2013-05-16 21:50:05 +0100 )edit

Let's say "Sheet1".

slowpoison gravatar imageslowpoison ( 2013-05-16 22:17:10 +0100 )edit

OK. See Andrew Pitonyakbook chapter "6.2. Display cell value, string, or formula" or function GetValueofCellbyName() in standard library Tools module Misc

JohnSUN gravatar imageJohnSUN ( 2013-05-17 09:49:34 +0100 )edit

1 Answer

Sort by » oldest newest most voted

answered 2013-06-09 09:55:09 +0100

oweng gravatar image

The information provided in the comment by @JohnSUN against the question has answered this query. I am merely repeating that detail here. Andrew Pitonyak covers referencing the value of a spreadsheet cell in his works:

  • OOo Useful macro information (ODT), 6.2. Display cell value, string, or formula
  • OOo Macros explained (ODT/PDF), 15.2. Sheet cells contain the data

You can also make use of the provided macro function GetValueofCellbyName() under LibreOffice Macros & Dialogs > Tools library > Misc module.

edit flag offensive delete link more

Question Tools


Asked: 2013-05-16 21:32:51 +0100

Seen: 3,033 times

Last updated: Jun 09 '13