T O P I C R E V I E W |
gavin.read |
Posted - 01/24/2003 : 6:42:32 PM Hi,
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
Any help much appreciated.
Gav.
P.S. I am using Origin 6.0
|
2 L A T E S T R E P L I E S (Newest First) |
gavin.read |
Posted - 01/28/2003 : 08:35:11 AM Thanks for that Mike.
For info, the loop iteration does actually work, with the loop cycling through all the worksheets.
Gav.
|
Mike Buess |
Posted - 01/24/2003 : 9:59:56 PM Hi Gav,
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.
This modified script should work...
doc -cw step; for(ii=1;ii<=count;ii++) { %W = step$(ii); newwks_b[ii] = %W_col[%W!wks.maxrows]; newwks_a[ii]$ = %W; };
Hope that helps.
Mike Buess Origin WebRing Member
Edited by - Mike Buess on 01/24/2003 10:01:20 PM
Edited by - Mike Buess on 01/24/2003 10:02:04 PM |