My function works well for one row of my sheet (row 4).
But I want to check all the rows in columns 2 and 7 where checkboxes are.
I thought about a loop but I would like to use arrays for a better and more efficient code.
ss = SpreadsheetApp.getActiveSpreadsheet();
sheet = ss.getSheetByName("Feuille 1");
function alertbox(){
var box1= sheet.getRange(4, 2).getValue();
var box2 =sheet.getRange(4, 7).getValue();
if (box1 ==true && box2 == true) {
var activcell = sheet.getActiveCell();
showAlert(activcell);
}
};
function showAlert(activcell) {
var ui = SpreadsheetApp.getUi();
var result = ui.alert(
'Conflit entre un autre hôtel qui a réservé aux même dates que vous !',
'Vous êtes sûr de continuer ?',
ui.ButtonSet.YES_NO);
// utiliser les réponses des utilisateurs
if (result == ui.Button.YES) {
// clicked "Yes".
ui.alert('Voyez avec l autre hôtel !');
} else {
// User clicked "No" or "X".
ui.alert('Ok on enlève votre choix...');
activcell.setValue(false);
}
}