The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Getting LabTalk to put a wks name in a worksheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

gavin.read

UK
15 Posts

Posted - 01/24/2003 :  6:42:32 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
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

Mike Buess

USA
3037 Posts

Posted - 01/24/2003 :  9:59:56 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
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
Go to Top of Page

gavin.read

UK
15 Posts

Posted - 01/28/2003 :  08:35:11 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks for that Mike.

For info, the loop iteration does actually work, with the loop cycling through all the worksheets.

Gav.

Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000