I'm trying to create a spreadsheet that hides rows based off of a certain cell (B2) value.
I'm having issues where sometimes my code doesn't on certain if statements but works on others. For instance, the, "Kombucha" and, "Koji" if statements don't work but the, "Sweet Fermentation" does.
Spreadsheet is here and below is my code:
function onEdit2(e) {
var sh=e.range.getSheet();
var acid=[4, 6, 8];
if(sh.getName()=='Master' && e.range.columnStart==2 && e.range.rowStart==2) {
e.source.toast(e.value);
if(e.value=="Acid") {
sh.hideRows(12,73);
sh.hideRows(33,52);
sh.hideRows(53,72);
sh.hideRows(73,84);
sh.showRows (9,11);
}
if(e.value=="Kombucha") {
sh.hideRows(53,72);
}
if(e.value=="Koji") {
sh.hideRows(12,32);
}
if(e.value=="Sweet Fermentation") {
sh.hideRows(12,61);
}
else{
sh.showRows(1,32);
sh.showRows(33,52);
sh.showRows(53,72);
sh.showRows(73,84);
}
if(e.value=="All"){
sh.showRows (1,100)
}
}
}
Thank you so much for your help. I'm very green to Javascript and would like to learn to make better spreadsheets for my company.