As a non-developer, could anyone advise on a script I could use to hide 3 cells based on what one cell says? Please see the sample spreadsheet
CodePudding user response:
When selecting Yes
the row in Sheet2
will hide.
This is the script used:
var sheet = "Sheet1";
var editingsheet = "Sheet2";
var val = "Yes";
var column = 3;
function onEdit() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeSheet = SpreadsheetApp.getActiveSheet();
var editingss = ss.getSheetByName(editingsheet);
if(sheet == activeSheet.getName()){
var cell = ss.getActiveCell();
var cellnotation = cell.getA1Notation();
var cvalue = cell.getValue();
if(cell.getColumn() == column){
if(cvalue == val){
var range = editingss.getRange(cellnotation);
editingss.hideRow(range);
}
}
}
}
And this is the result that I get when selecting Yes
on Funny item 1 and 12: