So I used to work with multiple projects on 1 sheet to use multiple OnEdit events. Now that the OnEdit events got more plenty and I have to many projects I need to group them in to one project.
Since I merged my code no longer works.
In one sheet I have 4 checkboxes.
function onEdit(e) {
if (e.range.getA1Notation() == "C4"){
Logger.log('C4 selected');
FunctionC4();
}
if (e.range.getA1Notation() == "C5"){
Logger.log('C5 selected');
FunctionC5();
}
if (e.range.getA1Notation() == "C6"){
Logger.log('C6 selected');
FunctionC6();
}
if (e.range.getA1Notation() == "C7"){
Logger.log('C7 selected');
FunctionC7();
}
}
So far this works great but when I then call my FunctionC4 (or any other) things stop working at my IF function
function FunctionC4() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = ss.getActiveSheet();
var Range = sheet.getRange(4,3);
var toggle = Range.getValue();
Logger.log(toggle);
if (toggle == "TRUE") {
Logger.log('C4 is true');
sheet.hideColumns(6, 15);
}
else if (toggle == "FALSE") {
Logger.log('C4 is false');
sheet.showColumns(6, 15);
sheet.hideColumns(11, 1);
}
}
My logger.log(toggle) still displays true or false. So I know toggle is either true or false and the function is called. I don't understand why the IF function doesn't read it. I never get the logger.log "C4 is true" or false.
I'm guessing it has something to do with my Range.getValue();
but after hours of searching I can't figure it out.