I have the simple trigger set to onEdit and used the code below to execute it. Everything works fine but when I try to shift the tab where my main function executes, the whole trigger stopped working and typeError comes up "cannot read property 'range' of undefined"
I have 3 sheets. Main sheet where function runs, 2nd sheet where my onEdit takes place and a secondary sheet. Trigger won't work when I shift my main sheet to the second or last tab.
function onEdit(e) {
if (e.range.getA1Notation() == 'C9') {
if (/^\w+$/.test(e.value)) {
this[e.value]();
e.range.clear();
}
}
}