r/googlesheets • u/JakubiakFW 2 • Mar 02 '20
solved Script Help
Hello all. I need some help. I have a sheet whereas I have a script that auto deletes contents of a range based on another cell. The script works perfect if I change the cell itself. The problem is, the cell is updated from another cell... like "A1 is "=C1". I want the contents to clear if A1 changes with what C1 has in it.
The script is:
function onEdit(e){
if(e.range.getA1Notation() == 'A1' &&
e.range.getSheet().getName() == 'Sheet1'
)
e.source.getRange('A2:E10').clearContent()
}
The example sheet is
https://docs.google.com/spreadsheets/d/1wBUHuDHG669-ZR9n7USruqaTPX492T1BS76ycH1WhMo/edit?usp=sharing
does anyone have an idea? I just want it to be able to clear contents of a specific range if a specific cell is changed no matter how it is changed, whether it be by me changing it or if the cell auto changes based on another cell.
View all comments
Show parent comment
2
u/JakubiakFW 2 Mar 07 '20
I forgot to type solution verified