Tiring of the repetition, I thought this was a good candidate for recording a tiny Macro & adding a toolbar button to launch it from any Calc file.
This appeared to work OK, but then I noticed errors in the results.
Boiling it down to a simple example:
If I have cell B2=A2-A1
then copy/pasting line 2 manually gives me B3=A3-A2 (required result).
but running the macro gives me B3=A3-A1...
I didn't find any explanation or fix for this yet.
Any advice welcome!
Details :
LibreOffice 3.4.4. in Lubuntu11.10
Method:
1. Select line 2
2. Record macro
3. Ctrl+C
4. Select line 3
5. Right click
6. Paste spacial...
7. Shift cells - Down (Selection - Paste all is already ticked)
8. OK
9. Stop macro
The macro as recorded:
Code: Select all
sub mac3
rem ----------------------------------------------------------------------
rem define variables
dim document as object
dim dispatcher as object
rem ----------------------------------------------------------------------
rem get access to the document
document = ThisComponent.CurrentController.Frame
dispatcher = createUnoService("com.sun.star.frame.DispatchHelper")
rem ----------------------------------------------------------------------
dispatcher.executeDispatch(document, ".uno:Copy", "", 0, Array())
rem ----------------------------------------------------------------------
dim args2(5) as new com.sun.star.beans.PropertyValue
args2(0).Name = "Flags"
args2(0).Value = "A"
args2(1).Name = "FormulaCommand"
args2(1).Value = 0
args2(2).Name = "SkipEmptyCells"
args2(2).Value = false
args2(3).Name = "Transpose"
args2(3).Value = false
args2(4).Name = "AsLink"
args2(4).Value = false
args2(5).Name = "MoveMode"
args2(5).Value = 0
dispatcher.executeDispatch(document, ".uno:InsertContents", "", 0, args2())
end sub