Basically what i'm trying to say is, this is a spreadsheet for trucks with trailers, if someone inputs a trailer in cell B, can i make it to throw a popup or a Modal or a warning that cell E should have a truck assigned to it, or data and not allow the user to leave cell E empty?. Appreciate the help. how can i do this with a script?
CodePudding user response:
Try this:
function onEdit(e) {
const sh = e.range.getSheet();
if(sh.getName() == "Your sheet name" && e.range.columnStart == 2 && e.range.rowStart > 1 && e.value) {
if(e.range.offset(0,3).getValue() == '') {
e.range.offset(0,3).setValue("Please Assign Truck Number Here");
e.source.toast('Please Assign Truck',"Truck Assignment",15);
}
}
}
- Dont forget to edit the sheet name