I am making my own D&D sheet for my friends. I would like this to be as cool and as complex as possible. Currently the onEdit function isn't even triggering . I am trying to hide certain rows based on J3, if J3 = 1 then row 7 will be hidden. In the future I will hide rows 7-10, if J3 >= 2 then it will show rows 7-10. When it changes nothing happens. Please help.
function onEdit() {
var sheet = SpreadsheetApp.getActive().getSheetByName('Actions')
var status = sheet.getRange('J3').getValue();
if (status == 1) {
sheet.hideRows(7);
} else {
if (status >= 2) {
sheet.showRows(7);
}
}
Logger.log('yay you did it')}
This works for me:
function onEdit(e) {
var sh=e.range.getSheet()
if(sh.getName()!='Actions')return;
var status=sh.getRange('J3').getValue();
if (status==1) {
sh.hideRows(7);
}else if(status>=2){
sh.showRows(7);
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.