I've got a script that moves a row from one tab "COMMUNICATIONS" to another tab "ARCHIVE" when a cell checkbox (column AE) is true but it's only working well with the row AE2 and it's not working when I check AE3 or AE6.
function onEdit() {
var sheetNameToWatch = "COMMUNICATIONS";
var sheetNameToMoveTheRowTo = "ARCHIVE";
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = SpreadsheetApp.getActiveSheet();
var range = sheet.getActiveCell();
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet1 = ss.getSheetByName(sheetNameToWatch);
var sheet2 = ss.getSheetByName(sheetNameToMoveTheRowTo);
var cell1 = sheet1.getRange("AE2:AE1000");
var x= cell1.getValue();
Logger.log("a",x);
if(cell1.getValue()== false) {
Logger.log("box not checked");
sheet1.showSheet();
} else if (cell1.getValue() == true) {
var targetSheet = ss.getSheetByName(sheetNameToMoveTheRowTo);
var targetRange = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);
sheet.getRange(range.getRow(), 1, 1,
sheet.getLastColumn()).moveTo(targetRange);
sheet.deleteRow(range.getRow());
}
}