Can someone tell me how to get a script to fill a worksheet column with worksheet names. I am processing lots of worksheets and I want to fill a column with the worksheet names, the rest of the worksheet row will have the various values I have collected from the relevant worksheets.
I set the column in question to text and numeric (the worksheet name is of the form step1 step2 step3 etc).
I have tried something like this (much simplified code);
doc -cw step;
for(ii=1; ii <=count; ii++) {
%H = step$(ii);
newwks_b[ii] = %H_col[%H!wks.maxrows];
newwks_a[ii] = "%H";
}
Everything works except for the newwks_a = "%H" statement.
For my own purposes it would be sufficient to set -
newwks_a[ii] = ii; // Which also works
But for the sake of anyone looking at the project after me it would be desirable to actually insert the worksheet name
1> %H is a system variable and you can't assign a value to it. It always holds the name the active window. If you insert %H=; after %H=step$(ii); you'll probably find that %H is the same at each iteration of the loop.
2> You must use a dollar sign on the left hand side when assigning a string value.