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
 Origin Forum
 reset column names
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

amorris

Canada
Posts

Posted - 10/04/2005 :  1:01:46 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Version (Select Help-->About Origin): 7.5
Operating System: winXP

Hi everyone,

I have a worksheet with about 10 columns. I'd like their names to be reset to the default "A,B,C,D...", however at the moment the names are all messed up like "A,D,E,G,B..." since I've inserted and deleted some columns. Is there any way to easily reset all the names (in labtalk or otherwise)?

Thanks,

Alexis

Mike Buess

USA
3037 Posts

Posted - 10/04/2005 :  2:13:04 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexis,

Don't think there's a built in way to rename columns but the following rather inelegant labtalk script will work if you have no more than 26 columns.

%Z=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z;
loop (i,1,wks.ncols) {wks.col$(i).name$=$(i)}; // first rename as numbers to avoid conflicts
loop (i,1,wks.ncols) {wks.col$(i).name$=%[%Z,#i]}; // now rename alphabetically

Mike Buess
Origin WebRing Member
Go to Top of Page

Hideo Fujii

USA
1582 Posts

Posted - 10/11/2005 :  11:54:22 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi Alexis,

The following script does the work beyond 26 columns, and gives the names like A, ... Z, AA, ... ZZ, AA1, AA2,...

%L=%H;
nn=wks.ncols;
window -t wks;
%M=%H;
for(ii=2;ii<nn;ii++) worksheet -c;
window -a %L;
for(ii=1;ii<=nn;ii++) {
%n=%(%M,@c,ii);
worksheet -n ii %n;
}
win -cd %M;


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