BarryTheLangoustine
New Coder
I'm using Google Sheets with Apps Script. I have a spreadsheet with a formula in cell AV3, which is based on the contents of cell AU3, which is based on the contents of cell B3. The formula in cell AV3 is =if(ISNUMBER(AU3),1,""). Cell B3 is controlled by a for loop in my script. When cell AV3 is blank, I want variable i to be written into cell A3, and when there is a number in cell AV3 I don't want anything written into cell A3.
here is my script. As it is, variable i is being written into cell A3 on every loop, not just when cell AV3 is blank.
here is my script. As it is, variable i is being written into cell A3 on every loop, not just when cell AV3 is blank.
JavaScript:
function LoopNumber() {
var spreadsheet = SpreadsheetApp.getActiveSpreadsheet();
var sheet = spreadsheet.getActiveSheet();
var CountStart = 1;
var CountFin = 5000;
var ColA = 2;
var cell = sheet.getRange("B3");
var out = sheet.getRange("AV3").isBlank;
var tbh = sheet.getRange("A3");
for (let i=0; i<CountFin; i++) {
cell.setValue(i);
if (out=false) {continue} else tbh.setValue(i);
SpreadsheetApp.flush();
Utilities.sleep(1000)
}
}