At the moment I am using the following code so that every time a check box is marked off in a column then the whole row is hidden. At the moment the script I have only works for one column and not for any other column. I would like the script to work for any column I choose. I am using Google Sheets.
function onEdit(e){
if (e.range.columnStart != 6 || e.value != "TRUE") return;
SpreadsheetApp.getActiveSheet().hideRows(e.range.rowStart);
}
I believe your goal is as follows.
In this case, how about the following modification?
This modified script uses the checkboxes of all columns.
function onEdit(e) {
const {range} = e;
if (!range.isChecked()) return;
range.getSheet().hideRows(range.rowStart);
}
This modified script uses the checkboxes of the columns "B", "D" and "F".
function onEdit(e) {
const columns = [2, 4, 6]; // In this case, the columns "B", "D" and "F".
const {range} = e;
if (!columns.includes(range.columnStart) || !range.isChecked()) return;
range.getSheet().hideRows(range.rowStart);
}
function onEdit(e) {
const sh = e.range.getSheet();
if (sh.getName() == 'Sheet0' && e.range.columnStart == 6 && e.value == "TRUE") {
sh.hideRows(e.range.rowStart)
}
}