I have various spreadsheets, in which copy paste areas are different than each other.
So I need some kind of copy paste maker. I will write name of the file and the area to be copied and the file to be written and area to be pasted.
Like C!= ...\xxx.ods D1= Sheet1.A3:E3 and F1: ...\xxy.ods G1=Sheet2.A6:E5
So this list of files will be processed in loop. But to be able to define a Copy paste area the way that I could find is
at first defining the row in the processor sheet with a loop like this
"for i to 100" CELL1=thiscomponent.sheets(0).getcellbyposition(10, i) CELL2=thiscomponent.sheets(0).getcellbyposition(12, i)
On the cell K1 I've input this: DOC2.Sheets.getByName("S1").getcellrangebyname("a3:c3")
and on the cell L1, i've written this. DOC3.Sheets.getByName("S1").getcellrangebyname("a4:c4")
How can I make a copy paste with the basic codes that I've written into spreadsheet?
CELL1.setdataarray (CELL2.getdataarray())
It seems like what I'm asking is a bit confusing. All I need to know is if I can turn a cell string into a macro code.
If I write this =thiscomponent.sheets.getbyname("E2").getcellrangebyname("F1") into a cell, can I use it as an addtess to another cell?
Code: Select all
sub trydis
Dim thing as object
Dim thang as object
Dim ranger1 as string
Dim ranger2 as string
ranger1=thiscomponent.sheets.getbyname("E2").getcellrangebyname("F1").string
ranger2=thiscomponent.sheets.getbyname("E2").getcellrangebyname("F6").string
thing.string = ranger1
thang.string = ranger2
thang.setFormulaArray (thing.getFormulaArray())
end sub