Code: Select all
copyrange = oExportsh.getcellrangebyposition(0,0,16,lastrow+1)
sourcedataarray = copyrange.getdataarray
'define the paste area of destination
newblankdoc = StarDesktop.loadComponentFromURL("private:factory/scalc","_Blank",0,Array())
newblankdocsh = newblankdoc.sheets(0)
newblankdocshrng = newblankdocsh.getcellrangebyposition(0,0,16,lastrow+1)
'paste
newblankdocshrng.setdataarray(sourcedataarray)
when i press ctrl + a to select all, and then ctrl + c to copy, then ctrl + v to paste to another new sheet, it will only copy the filtered data(visible), how to do exactly like this in macro ?