I am using:
function datavalidation(event) {
var ColA = 1;
var changedRange = event.source.getActiveRange();
if (changedRange.getColumn() == ColA) {
var destinationRange = event.source.getActiveSheet().getRange(changedRange.getRow(),ColA+1);
var sourceRange = event.source.getActiveSheet().getRange(changedRange.getRow(),ColA+2,changedRange.getColumn(),10);
var rule = SpreadsheetApp.newDataValidation().requireValueInRange(sourceRange).build();
var rules = destinationRange.getDataValidations();
for (var i = 0; i < rules.length; i++) {
for (var j = 0; j < rules[i].length; j++) {
rules[i][j] = rule;
}
}
destinationRange.setDataValidations(rules);
}
}
to create dropdown menus in column 2 when column 1 is edited. It's working fine for the most part but it is doing something unexpected when I remove any of the data validation from column 2. When I do this, which might be never, it runs the script on the first row of column 2 even though I did not change column 1. Just trying to understand what is going on here. Thanks
See public doc here: https://docs.google.com/spreadsheets/d/1kYncT7bOYWp73yr3Lh4LQreTpRFc8lZL3siqpP4xsvA/edit?usp=sharing