mercredi 15 janvier 2020

Can this code be edited so that when row x is moved over to Sheet2, the row below it moves up to fill the space row x was in?

I'm working in Google Sheets. This is my code so that when checkbox in column 1 = true, the row moves from Sheet1 to Sheet2. The issue is that when the row moves over, the row below it does not move to fill the space the first row was in.

I got this code from an answer to one of my other questions.

function onEdit(e) {
  var sh=e.range.getSheet();
  if(sh.getName()!='Sheet1')return;
  if(e.range.columnStart==1 && e.value=="TRUE") {
    var row1=sh.getRange(e.range.rowStart,1,1,sh.getLastColumn());
    var tsh=e.source.getSheetByName('Sheet2');
    row1.moveTo(tsh.getRange(tsh.getLastRow()+1,1)); 
  }
}

Is there a way to edit this code so that when a row is moved over, the row below it moves up to fill the space the row was in? I am not good at coding, by the way.

Thank you much!




Aucun commentaire:

Enregistrer un commentaire