Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How do I copy a cell value into a macro variable in Calc?

I am writing a macro to process values in a Calc spreadsheet. I need to copy the value in each cell (as selected) into a variable, process it and then paste the result back into either the same cell or a cell relative to the original cell (eg: to the right).

How do I do this?

In MS Office I would use something like a variable xstring = ActiveCell.Value and then ActiveCell.Value = xstring.

How do I copy a cell value into a macro variable in Calc?

I am writing a macro to process values in a Calc spreadsheet. I need to copy the value in each cell (as selected) into a variable, process it and then paste the result back into either the same cell or a cell relative to the original cell (eg: to the right).

How do I do this?

In MS Office I would use something like a variable xstring = ActiveCell.Value and then ActiveCell.Value = xstring.

Your response probably works (not tested yet), but it is specific to row and col being known. I would like to be able to select the range of cells using my mouse (from 1 to many) and run the macro through the entire range. Your code suggests that row and col are hard coded.