Page 1 of 1

[Calc, Basic] Copy visible cells

PostPosted: Wed Feb 14, 2018 4:03 pm
by Villeroy
2018-11-23: I made the code more modular. Now we can copy values only, values and formulas or a full copy&paste
Copies the visible cells from a selected rectangle of cells into a merged target range skipping filtered rows and hidden rows and columns as well. The built-in copy&paste operation skips only filtered rows.
The demo document has two source sheets with hidden/filtered cells and one target sheet with all cells visible. Play with it.
Import or copy the library "Calc" to the global location "My Macros" and use one of the routines copyValues, copyFormatAndValues, copyFormatAndFormulas.

Note on formulas: Copying formulas may be dangerous because relative references may refer to wrong cells. As a demo you may hide column D of the first example sheet and call copyFormatAndFormulas. The formulas in column E refer to the left neighbour cells in column D but in the target sheet left neighbours won't be the text values of the cells that used to be in column C.