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
 All Forums
 Origin Forum for Programming
 LabTalk Forum
 Copying column from different worksheets to one

Note: You must be registered in order to post a reply.
To register, click here. Registration is FREE!

Screensize:
UserName:
Password:
Anti-Spam Code:
Format Mode:
Format: BoldItalicizedUnderlineStrikethrough Align LeftCenteredAlign Right Horizontal Rule Insert HyperlinkUpload FileInsert Image Insert CodeInsert QuoteInsert List
   
Message:

* HTML is OFF
* Forum Code is ON
Smilies
Smile [:)] Big Smile [:D] Cool [8D] Blush [:I]
Tongue [:P] Evil [):] Wink [;)] Clown [:o)]
Black Eye [B)] Eight Ball [8] Frown [:(] Shy [8)]
Shocked [:0] Angry [:(!] Dead [xx(] Sleepy [|)]
Kisses [:X] Approve [^] Disapprove [V] Question [?]

 
Check here to subscribe to this topic.
   

T O P I C    R E V I E W
ox1986 Posted - 09/09/2014 : 11:46:43 AM
Hi,

I would be grateful for some help. Im new to Labtalk and I am trying to copy many columns (each column is from a different worksheet in a different workbook) and put them into a new workbook so that they all sit next to each other

Is there a way to do this through looping? I've not been able to work it out thus far

Many thanks for any suggestions

H
4   L A T E S T    R E P L I E S    (Newest First)
qavo08 Posted - 07/17/2017 : 5:55:28 PM
It works perfectly. Thank you Yuki.
yuki_wu Posted - 07/16/2017 : 11:25:45 PM
Hi,

Please modify your code as follows:

// Add the missing semicolon, 
// and declare a range for a column by its index directly 
// since wks.col is used to access the column attributes
range rr = $(iii); 
// Use double equal-sign 
// while single equal-sign is used to assign value,  
// rr.name$ means the short name 
// while rr.lname$ means the long name
if (rr.lname$ == "Mean")


Hope it can be some help.

Regards,
Yuki
OriginLab
qavo08 Posted - 07/16/2017 : 01:03:41 AM
Hello,

I want to copy a column named "Mean" in each workbook to a new workbook. Each workbook has one sheet. I tried to use the code below, but it always copies all columns in every workbook to the new workbook. I tried to add an else, break; but it's still the same. Any suggestion would be appreciated.

Here is the code I used:

newbook name:=Collected1;
tcol = 1;
doc -e W
{
if(page.longname$ != "Collected1")
{
loop(ii,1,page.nlayers)
{
page.active = ii;
loop(iii,1,wks.nCols)
{
range rr = wks.col$(iii)
if (rr.name$ = "Mean") 
{
colforcopy = iii;
wrcopy
ow:=[Collected1]Sheet1!
c1:=colforcopy
c2:=colforcopy
dc1:=tcol
label:=1
format:=1;
tcol++;
}
}
}
}
}

greg Posted - 09/09/2014 : 2:35:18 PM
You don't specify what column to copy...

Here is an example that copies all column 3 to a new worksheet:

colforcopy = 3;
newbook name:=Collected;
tcol = 1;
doc -e W
{
if(page.longname$ != "Collected")
{
loop(ii,1,page.nlayers)
{
page.active = ii;
wrcopy
ow:=[Collected]Sheet1!
c1:=colforcopy
c2:=colforcopy
dc1:=tcol
label:=1
format:=1;
tcol++;
}
}
}


The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000