Here is my function
function Cool() { var h = SpreadsheetApp.getActiveSpreadsheet();
var range = 0; var count = 1; var alph = ["A", "B", "C", "D", "E",
"F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S",
"T"]; for (i = 0; i < 20; i+=0.5) {
if (i == 19 && count != 5) {
i == 0;
count += 1;
} else if (i == 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 || 10 || 11 || 12 || 13 || 14 || 15 || 16 || 17 || 18) {
range = h.getSheets()[0].getRange(alph[i] + count + ":" + alph[i] + count);
SpreadsheetApp.setActiveRange(range);
randomize();
} } }
that has an error on the
range = h.getSheets()[0].getRange(alph[i] + count + ":" + alph[i] + count);
Have you looked at the data you are using ?
here is a slightly modified version of your script with a logger to see what happens and the log result below. I guess you’ll understand why you get error messages . It seems your condition simplified syntax doesn’t do what you wanted, does it ?
btw what is the final purpose of this script ? could you explain the idea ?
If you wanted to do something only on integer values of i it would be easier to use something like
if(i==parseInt(i))for example…LOGGER RESULT :
EDIT : being curious by nature I did try your code with the suggested
IFstatement and I get the following log (much nicer;-) but quite useless, a simple for loop with unity increments would do the same…so the question remains : what was the final goal ?