This onEdit
trigger implements the feature as given by Ben Collins.
I was motivated to see if the pattern as given by Ben could be abstracted away so that changes to the sheet name, or changes to the area of the checkboxes changed, and the onEdit
trigger wouldn't need to be modified.
For example, clicking on D1 should change it to checked (X
), and uncheck B1.
A | B | C | D | E | |
---|---|---|---|---|---|
1 | o | X | o | o | o |
2 | o | o | X | o | o |
3 | o | o | X | o | o |
A | B | |
---|---|---|
1 | =Sheet1!A1:E3 |
This Settings tab just holds a range that resolves to the area where checkboxes are desired. Note that the value of A1 will be an error (#VALUE
), but we do not use the value (we just use the formula) so can be ignored.
This works by reading in the settings tab which holds reference to the checklist area. It then turns it into a grid, so we have columnStart
, rowStart
etc.
Then it builds an array of r1c1
style notation, deletes the one that the user clicked, and calls .uncheck
on the resulting range list.