Code: Select all
Option Explicit
Sub CopyAndPaste1
Dim sSource As Object : sSource = ThisComponent.CurrentController.Selection.getRangeAddress()
Dim dDestination As Object : dDestination = ThisComponent.CurrentController.ActiveSheet.getCellByPosition(4,0).getCellAddress()
ThisComponent.CurrentController.ActiveSheet.copyRange(dDestination, sSource)
End Sub
Sub copy_range_and_paste_it_to_another_cell
'Based on >> https://forum.openoffice.org/en/forum/viewtopic.php?f=25&t=16413#p160853
Dim oSheet1 As Object : oSheet1 = thisComponent.Sheets.getByIndex(0)
Dim oSheet2 As Object : oSheet2 = thisComponent.Sheets.getByIndex(1)
Dim source As Object : source = oSheet1.getCellRangeByName("A1:B3").getRangeAddress()
Dim destination As Object : destination = oSheet2.getCellByPosition(0,0).getCellAddress()
oSheet1.copyRange( destination , source )
End sub
How can Sub CopyAndPaste1 remain source cell's content in memory after copy and paste a cell ?
I would like to paste it in the other cell(s) manually.