Hello!
I am trying to write a macro that would copy the data from H23:I32 to adjacent columns J23:K60. Assuming there are values in J23:K60, I wish to paste the data below the last cell with data.
The sheet I am working with is 'Loot'.
Unfortunately, my code doesn't search for the last cell with value and always pastes the data to J23. Thefore my list gets overwritten instead of values being added to it.
function UpdateGroup() {
var spreadsheet = SpreadsheetApp.getActive();
const sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Loot');
const lastRow = sheet.getLastRow();
sheet.getRange("H23:I23" + lastRow).copyTo(sheet.getRange("J23:K23" + (lastRow + 1)), SpreadsheetApp.CopyPasteType.PASTE_VALUES, false);
};
How would I go about fixing my code so that I have a growing list in J23:K from H23:I values?
Many thanks in advance!
Bookmarks