I have sheet in which whenever there is an edit, for example in cell "A1", the background color of this cell will be changed to green. I am using on edit trigger. This works when I manually enter value in cell "A1".
But if this cell is connected with another cell "B2" and any change in "B2" cell will automatically change value in cell "A1" but when it happens, the background color does not change. I think it is because I did not edit value manually. Is there any way that we can change background color of cell "A1" whenever it's value is changed due to another cell? Hope you got the point. I am using following script. Any help would be appreciated.
function HighlightCell() {
var Sheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Sheet1");
var cell = Sheet.getActiveCell();
Logger.log(cell);
SpreadsheetApp.flush();
cell.setValue("Highlighted");
SpreadsheetApp.flush();
cell.setBackground("green");
}
onEdit
trigger is activated upon user edits only. Formulas or scripts can not trigger anonEdit
function. I am afraid you have to redesign your logic. – soMariogetFormulas
and then check if you edit cell B1 which of the formulas are going to be affected, and then adjust the color of these cells. Workarounds exist, the question is how open you are to these workarounds. – soMario