samedi 25 août 2018

How to use multiple true statements in If condition?

The last If statement doesn't work when executed. The code has to be executed again for it to work. So is it possible to use multiple true statements in a IF condition?

function sort(){

  var SS = SpreadsheetApp.getActive();
  var cell0 = SS.getSheetByName("Sheet1").getRange("B4:K4");
  var cell1 = SS.getSheetByName("Sheet1").getRange("B5:K5");
  var cell2 = SS.getSheetByName("Sheet1").getRange("B6:K6");
  var cell3 = SS.getSheetByName("Sheet1").getRange("B7:K7");
  var cell4 = SS.getSheetByName("Sheet1").getRange("B8:K8");


  var lecc0 = SS.getSheetByName("Sheet1").getRange("L4");
  var lecc1 = SS.getSheetByName("Sheet1").getRange("L5");
  var lecc2 = SS.getSheetByName("Sheet1").getRange("L6");
  var lecc3 = SS.getSheetByName("Sheet1").getRange("L7");
  var lecc4 = SS.getSheetByName("Sheet1").getRange("L8");

  var cl = SS.getSheetByName("Sheet1").getRange("B4");
  var cl1 = SS.getSheetByName("Sheet1").getRange("B5");


  var clv = cl.getValue();
  var cl1v = cl1.getValue();

  if((cl.isBlank()) && cl1 !== ""){cell1.copyTo(cell0)}; 
  if(clv == cl1v){cell1.clearContent()} else {};

}

Aucun commentaire:

Enregistrer un commentaire