Hi,
You may try the following script, which gives the same result with the syntax you're using. This script loops over all columns from left to right and return to the column index number of the first X column.
int colx=0;
loop(var, 1, wks.nCols)
{
if(wks.col$(var).type==4)
{
colx=var;
break;
}
}
colx=;
Kathy
Originlab