Here is my issue :
My code below does not work because of the line: current.uncheck();
And the log say : "This operation is not supported on a range with a filtered-out row."
But this sheet is not supposed to contain a filter, I also try to remove the potential filters without success.
if(current.isChecked()) // If the check box is checked
{
// I put some data in a array :
var arraySupport = rangeColumnToArray(ss.getSheetByName("import_support").getRange("A1:A15"))
var dataSheet = SpreadsheetApp.getActiveSpreadsheet().getSheetByName("Copy of Data Bank");
// I change criteria filter on other sheet :
var criteriaSupport = SpreadsheetApp.newFilterCriteria()
.setHiddenValues(arraySupport)
.build();
dataSheet.getFilter().setColumnFilterCriteria(24, criteriaSupport);
ss.getRange("G5:G").clearContent(); // clear eventual content
copyExo(); // This fonction copy one column from the filtered sheet (dataSheet) on activeSheet
activeSheet.getFilter().remove(); // I try that without success
current.uncheck(); // And I try to uncheck the checkbox
}
Thank's for all the help you will provide me.
Although I'm not sure about the relationship between current
and the ranges which are used in the if statement, in order to work current.uncheck()
, I would like to propose the following modification.
if(current.isChecked()) // If the check box is checked
{
current.uncheck(); // <--- "current.uncheck();" at the last line in this function is moved to here.
// I put some data in a array :
var arraySupport = rangeColumnToArray(ss.getSheetByName("import_support").getRange("A1:A15"))
copyExo()
, I think that in your script, if current
is not changed in the script in your if statement, current.uncheck()
at the last line works. For example, when you want to confirm about it, how about putting if (current) console.log(current.getA1Notation())
at each line of script? By this, when the value of current
is changed, you can see it at the log.