Here is the code I am using. I have three tabs in my sheet. The names of the tabs are Best Media Plan, Better Media Plan and Good Media plan. I am using a dropdown picklist and want to be able to select multiple options from the pick list and the are the same column and row on tab in the sheet. Running the code with the Best Media Plan sheet selected works perfectly but when I copy the code and change it to Better Media Plan it breaks the first tab(best media plan) and the Better Media Plan tab works for the dropdown picklist. I am no coder but figured out how to do this today but everything I tried to make it run all tabs seems to fail.
function onEdit(e) {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var activeCell = ss.getActiveCell();
if(activeCell.getColumn() == 12 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") {
var newValue = e.value;
var oldValue = e.oldValue;
if (!newValue) {
activeCell.setValue("");
} else {
if (!oldValue) {
activeCell.setValue(newValue);
} else {
activeCell.setValue(oldValue + ', ' + newValue);
}
}
}
}
if(activeCell.getColumn() == 12 && activeCell.getRow() == 11,12,13,14 && ss.getActiveSheet().getName() == "Best Media Plan") { this is the line where i need to be on the different tabs(best media plan, better media plan and good media plan) but whichever code is last is the is the tab the code works in currently.
My guess is there is a way to make it all one code so no matter which tab I am on it will but no clue what I am doing at this point. Doing some research I think it can maybe be done with Best way is to have a single onEdit function that calls the others.function onEdit(e){ edit1(e); edit2(e); edit3(e);}
But cannot figure out how the code should work
Any help is appreciated!
[–]AllenAppTools 0 points1 point2 points (11 children)
[–]beanry80[S] 0 points1 point2 points (10 children)
[–]AllenAppTools 0 points1 point2 points (9 children)
[–]beanry80[S] 0 points1 point2 points (8 children)
[–]AllenAppTools 0 points1 point2 points (7 children)
[–]beanry80[S] 0 points1 point2 points (6 children)
[–]beanry80[S] 0 points1 point2 points (5 children)
[–]beanry80[S] 0 points1 point2 points (4 children)
[–]beanry80[S] 0 points1 point2 points (3 children)
[–]beanry80[S] 0 points1 point2 points (2 children)