0

The cells in column A are getting checked if another cell in column 11 is getting selected from a drop down list. I have a code that works right now if I am manually clicking the check box, but it will not work if the formula is applied to it. Below is my code that works if I am manually checking the checkbox in Column A. End Goal: I want to select a value from the drop down list in column 11 and it automatically put a check in the check box in column A and then my onEdit script recognize that the checkbox has been checked and it will auto archive that row.

function onEdit(event) {                        
// assumes source data in sheet named main                      
// target sheet of move to named Completed                      
// getColumn with check-boxes is currently set to column 1 or A                     
var ss = SpreadsheetApp.getActiveSpreadsheet();                     
var s = event.source.getActiveSheet();                      
var r = event.source.getActiveRange();                      
                        
if(s.getName() == "ACTIVITY REPORT" && r.getColumn() == 1 && r.getValue() == true) {                        
var row = r.getRow();                       
var numColumns = s.getLastColumn();                     
var targetSheet = ss.getSheetByName("Archive");                     
var target = targetSheet.getRange(targetSheet.getLastRow() + 1, 1);                     
s.getRange(row, 1, 1, numColumns).moveTo(target);                       
s.deleteRow(row);                       
}                       
}                       
Rubén
  • 34,714
  • 9
  • 70
  • 166
Laura W.
  • 1
  • 3
  • I don't think so. It needs to be a user edit – Cooper Apr 06 '22 at 18:46
  • The onChange of changeType other will trigger for things like imports. But the event object for the onChange is really limited. – Cooper Apr 06 '22 at 18:48
  • @Cooper This is the formula I had in my column that was making it automatically put a check in the checkbox. =if(AND(B2>0,ISBLANK(B2)=FALSE),TRUE,FALSE) – Laura W. Apr 06 '22 at 20:36

0 Answers0