Reputation: 1
I have a simple onEdit
function that I use on other sheets. I have had no issue when using this in the past. As of late, this function does not run.
function onEdit(e) {
var sheet = e.range.getSheet();
var name = sheet.getSheetName()
Logger.log(name)
if(e.range.getA1Notation() === "C3" && name == 'Main') {
sheet.getRange("C4").clearContent()
}
}
I even added the Logger.log()
call to check and make sure I wasn't insane. But nope, it won't run.
I have even tried making a test sheet with no additional code to interfere with the onEdit
call... no dice.
Any ideas? I'm pretty lost on this one.
Thanks, Marcus
Upvotes: 0
Views: 48
Reputation: 121
Based on the script you posted, the function would only be applicable to a sheet named "Main" and would only affect Cell C4 if Cell C3 is edited.
First of all, Logger.log would not show anything if the script was not initiated from the script code itself, therefore, it would not be possible to check that way. Therefore, I checked using var ui = SpreadsheetApp.getUi() and creating an alert. everytime i made an edit.
Secondly, based on that check, the script that you provided did indeed run. Therefore, this leaves 4 possible sources of error. 1) the sheet that you are making the edit on is not named "Main". 2)the cell you are editing is not cell C3, 3) the cell C4 is empty and there is nothing to clear 4) You did not make the edit, i.e. the change in C3 was not yet input into the cell because you have not keyed in enter or selected a place outside of the cell.
Upvotes: 3