Run Function onedit in two tabs of a worksheet

0

I have a spreadsheet with three tabs being a "May", "Visit-Upas" and "Alarm Trigger". I want it to automatically set the time from filling in a cell. For the tab described as "MAY."

Iusedthisscriptbelow,itlaunchesthetimeintheindicatedfieldasshowninthefigure.

functiononEdit(){varactiveSheet=SpreadsheetApp.getActiveSheet();varcapture=activeSheet.getActiveCell();vardata=newDate();data=Utilities.formatDate(data,"GMT-03:00","HH:mm''");
    if(activeSheet.getName() == 'MAIO'){
        switch(capture.getColumn()){
            case 7:
                var add = capture.offset(0,1);
                add.setValue(data);
                break;
            case 9:
                var add = capture.offset(0,1);
                add.setValue(data);
            break;
        };
    };

}

I just need her to do this also on the "Visit-Upas" and "Alarm Trigger" tab. I added one more, changing the script, to the desired worksheet, it starts to function by performing function on the next tab, but does not perform the operation in the first one.

Someone can help me, as I have no experience in javascript, I'm just curious trying to optimize the time with releases.

    
asked by anonymous 10.05.2018 / 18:33

0 answers