0

As said in the title simply, I have a check box at Cell A1, I want to check it and uncheck it manually to hide a few rows in the sheets, say row 2,3. I've drafted the code below, what am i doing wrong?

function onEdit(e) {
  var ss = SpreadsheetApp.getActiveSpreadsheet();
  var sheet = ss.getSheets()[0];
  if (sheet.getCell(1,A).isChecked() === 'TRUE');

  if (e.value == "TRUE") {
    SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().hiderows(2, 3);
  }
  else if (e.value == "FALSE") {
    SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().showColumns(2, 3);
  }
}

Error says

Error
ReferenceError: A is not defined

  • So when are you going to define A? You are using a variable called A that you never defined. But you already knew that from the error. – CodeCamper Oct 28 '22 at 17:10

0 Answers0