I have 3 sheets. Example, my main data is in Sheet1
if I input a data on Row 14 which is the ACTIVEROW then in that column let says D14
, contains "N/A" or "1" value I want to copy that whole row data and paste to Sheet2
ELSE it paste on Sheet3
to the lastrow first empty cell.
Sorry for the lack of information. I provide an example of sheet or image above for additional info. Example, I want to input new data in Sheet 1 if the value in the cell is "Male" copy the whole row and paste it to the Sheet.Male else if the value is "Female" it will paste it to the Sheet!Female.
function onEdit(e) {
const sh = e.range.getSheet();
if(sh.getName() == "Sheet1" && e.range.columnStart == 14) {
let vs = sh.getRange(e.range.rowStart,1,1,sh.getLastColumn()).getValues();
if(e.value == "N/A" || e.value == 1) {
let dsh = e.source.getSheetByName("Sheet2");
dsh.getRange(r.range.rowStart,1,1,vs[0].length).setValues(vs)
} else {
let dsh = e.source.getSheetByName("Sheet3");
dsh.getRange(dsh.getLastRow() + 1,1,1,vs[0].length).setValues(vs);
}
}
}
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.