Guest User

Untitled

a guest
Sep 13th, 2017
737
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onEdit(e) {
  2.  
  3.   var editRange = { // B3:AL13
  4.     top : 3,
  5.     bottom : 12,
  6.     left : 2,
  7.     right : 38
  8.   };
  9.  
  10.   var range = e.range
  11.   var sheet = range.getSheet();  //Get sheet from which the event occured
  12.   var name = sheet.getName();
  13.  
  14.   if (name != "Section 1 Homework") return; //Exit if sheet is not a sheet where cells should be changed
  15.  
  16.   // Exit if we're out of range
  17.   var thisRow = e.range.getRow();
  18.   if (thisRow < editRange.top || thisRow > editRange.bottom) return;
  19.  
  20.   var thisCol = e.range.getColumn();
  21.   if (thisCol < editRange.left || thisCol > editRange.right) return;
  22.  
  23.   //Exit if the cell is not blank
  24.   if (!range.isBlank()) return;
  25.  
  26.   //Set the cell value to the default formula
  27.   range.setValue( "=if(INDEX('Section 1 Attendance'!A1:AL12, " + thisRow + ", " + thisCol + ") = \"A\", \"A\", \"\")" )
  28. }
RAW Paste Data