trying to write and if statement in google sheets to hide a range of columns dependent on cell value in D4
If D4 == 1 hide columns H:AA If D4 == 2 hide columns O:AA Else show A:AA
Code below:
var cell = "D4";
var value1 = 1;
var value2 = 2;
var value3 = 3;
var activeSheet = ss.getActiveSheet();
function HideColumn(); {
If(cell == value1) {
activeSheet.hideColumn("H:AA");
Else If(cell == value2) {
activeSheet.hideColumn("O:AA");
Else If(cell == value3) {
activeSheet.unhideColumn("H:AA");
}
}
}
}
Aucun commentaire:
Enregistrer un commentaire