mercredi 9 mars 2022

Google Sheets Horizontal Radio checkboxes

I am trying to create radio checkboxes, i managed to make it work when the checkboxes are in vertical as shown in the exemple sheet bellow with the tab name 'Radio 1' but i have another tab 'Radio 2' where the checkboxes are aligned horizontally and are not aligned one after the other but after every 2 cells, the first Radio works with the following code

 function onEdit(e) {
  if (e.range.columnStart != 2 || e.range.rowStart == 1 || e.range.rowStart > 8 || e.value != "TRUE") return;
 let r = SpreadsheetApp.getActive().getActiveSheet().getRange(2,2,7);
  let checks = r.getValues();
  for (let i in checks){
    if(checks[i][0] == true && +i != e.range.rowStart - 2)
    checks[i][0] = false;
    }
  r.setValues(checks);
}

but i cant make it to work when adapting to the second radio tab, any ideas?

sheet link




Aucun commentaire:

Enregistrer un commentaire