I am trying to move the content from one table to another field within one sheet when the checkbox is checked. Currently, I have fiddled around and got the checkbox within a range to act like a radio button but have had no luck trying to figure out how to copy the content to another cell. Is there a way to do it?
https://docs.google.com/spreadsheets/d/1fLpPZro_8olt4ASEhIMyzSjjvPeeTlqKlIvAWF4eamk/edit?usp=sharing
*function onEdit(event) {
// Select only one checkbox
try {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var sheet = event.range.getSheet();
if( sheet.getName() === 'Sheet1' ) {
if( event.range.getColumn() === 4 ) {
var range = sheet.getRange(4,4,3,1);
var checks = range.getValues();
var valid = range.getDataValidations();
for( var i=0; i<checks.length; i++ ) {
if( valid[i][0].getCriteriaType() === SpreadsheetApp.DataValidationCriteria.CHECKBOX )
checks[i][0] = false;
}
range.setValues(checks);
event.range.setValue(event.value);
if( event.value === true ) {
event.source.getSheetByName('Sheet1').getRange(4,4,3,1).setValue(event.range.getRow());
}
}
}
}
catch(err) {
SpreadsheetApp.getUi().alert(err);
}
}*
Aucun commentaire:
Enregistrer un commentaire