I am running a script that automatically organizes priority in a to-do list. It works great on the current tab, but when moved to a sheet within the worksheet the same OnEdit function will not run. Here is the code below:
function myFunction() {
}
function onEdit(B){
var sh0 = SpreadsheetApp.getActiveSpreadsheet().getSheets()[0];
var editedCell = sh0.getActiveRange().getColumnIndex();
if(editedCell == 1) {
var range = sh0.getRange("A4:G");
range.sort({column: 3, ascending: true});
}
}
I also have a script to delete rows when marked "completed" and it works fantastically throughout the entire sheet.
function myFunction() {
}
function onEdit(){
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow();
for( i=1 ;i<=lastRow ; i++) { // i <= lastRow
var status = sheet.getRange("F"+i).getValue();
if (status == "Completed") {
sheet.deleteRows(i);
}
}
}
myFunction
function as it's does nothing and apparently you are not using it.