Trying to create a function where I can copy an entire block of cells depending location of button where script is activated (getting them to select works fine):

spreadsheet.getCurrentCell().offset(-25, -3, 26, 4).activate();

And paste into Q54.

I can only seem to achieve this using absolute values ie:

spreadsheet.getRange('B2:E27').copyTo(spreadsheet.getActiveRange(), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);

But B2:E27 will move around depending on where the script runs, thus my problem. Needs to copy relative from where activated: (-25, -3, 26, 4)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.