Monday, 19 August 2013

JavaScript via Cscript Runtime Error

JavaScript via Cscript Runtime Error

I'm writing a basic script for the sake of data entry into Excel with
Jscript, and I've run into a bit of a roadblock with a strange error (the
returned error isn't so much strange, moreso how to go about fixing it).
I'm basically looking for the last free row in my Worksheet by checking
the Cells.(i, 8).Value to see if there are two consecutive rows that are
empty, break the loop to retain that index i, and perform data entry.
var ts = new String(data.ReadLine());
var t=ts.split(",");
if(search==t[0])
{
var i;
for(i=0; i<wks.UsedRange.Rows.Count; i++)
{
if(wks.Cells(i,11).Value==null)
{
WScript.StdOut.Writeline("empty at "+i);
break;
}
}
When compiling through cmd, I get: Microsoft JScript runtime error:
Expected ';' The returned line is on the if(wks.Cells) line, char 4. I'm
not sure if this is bad programming on my part, or something I'm
completely overlooking...

No comments:

Post a Comment