I want a code or a Formula that can copy a row to another spreadsheet based on the text on the column B, but i just want to copy the Column A,B,C and D...so for example, if column B name is Stator, i want to copy the row to the spreadsheet Stator, if the name is Alternator, i want to copy the row to Alternator Spreadsheet.
I already tried this one:
function yourfunction() {
var ss=SpreadsheetApp.getActive();
var sh1=ss.getSheetByName("Stator");
var sh2=ss.getSheetByName("Prototype Number");
var rg1=sh1.getRange(1,2,sh1.getLastRow(),sh1.getLastColumn()-1);//starting at column2
var data=rg1.getValues();
for(var i=1;i<data.length;i++) {
if(data[i][6]=="Estator") {
sh1.getRange(i+1,2,1,sh1.getLastColumn()-1).copyTo(sh2.getRange(sh2.getLastRow()+1,1,1,sh1.getLastColumn()-1));
}
}
}
But didn't work.
I also tried a macro record, but didn't work because I couldn't find a way to paste the row to a new row every time.
Stator
? - soMario