ZiGoomul

radio button

Oct 5th, 2020 (edited)
402
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function onEdit() {
  2.   let ss = SpreadsheetApp.getActiveSpreadsheet();
  3.   let sw = ss.getSheetByName("Лист2");
  4.   let activeCell = sw.getActiveCell().getRow();
  5.   let button = sw.getRange(1, 2, sw.getLastRow(), 1).getValues();
  6.  
  7.   for(let i = 1; i <= button.length; i++){
  8.     if(i !== activeCell){
  9.       sw.getRange(i, 2).setValue("false")
  10.     }
  11.   }
  12. }
  13.  
  14. function onSelectionChange() {
  15.   let ss = SpreadsheetApp.getActiveSpreadsheet();
  16.   let sw = ss.getSheetByName("Лист2");
  17.   let activeCell = sw.getActiveCell().getRow();
  18.   let button = sw.getRange(1, 2, sw.getLastRow(), 1);
  19.   let radioButton = new Array(sw.getLastRow());
  20.  
  21.   radioButton.fill(["🔳"]);
  22.   radioButton.splice(activeCell-1, 1,["🔘"])
  23.   button.setValues(radioButton)
  24. }
  25.  
  26.  
  27.  
Add Comment
Please, Sign In to add comment