Can anyone help me do this? My problem is that all of my three (3) codes has the same name "onEdit". How can I run three (3) of of them?
There is a suggestion that I need to change their name, but when I change the names my codes wont run.
Can anyone post an example code for me, for my reference? Please?
function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var lastRow = sheet.getLastRow();
for (p=1 ; p<=lastRow ; p++) { // p <= lastRow
var status = sheet.getRange("C"+p).getValue(); // Change P to the completed column
if (status == "no") { // status == "no"
sheet.hideRows(p);
}
}
}
function onEdit() {
var spreadsheet = SpreadsheetApp.getActive();
var sheet = spreadsheet.getActiveSheet();
var cell = spreadsheet.getActiveCell();
var col = cell.getColumn();
var row = cell.getRow();
var rows = [1, 2, 3];
// This is a list of the rows that should blink if edited.
if (col === 7 && rows.indexOf(row) !== -7 && sheet.getName() === 'Sheet1') {
// If the edited cell is in column A (1) and if the edited cell
// is one of the rows listed
for (var num = 0; num < 50; num++) {
var colour = num%2 === 0
? 'GOLD'
: 'WHITE';
// Using ? and : like this is called a ternary operation. It's a
// shorter form of if. ifStatement ? true : false.
sheet.getRange('G' + row + ':G' + row).setBackground(colour);
// Get the range for the edited row and set the bg colour
SpreadsheetApp.flush();
Utilities.sleep(500);
}
}
}