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
 copy and past column
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Bigprophete

France
20 Posts

Posted - 03/16/2016 :  01:49:15 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hello,
I have a small problem.
I have a lot of workbook (eg. 10, 20 or 30). I want to copy the column 7 of each worbook and past in a new workbook called results (for example). I have the following problem, it create the workbook result with only the value of the first workbook...

doc -ef W {
range r1 = [%H]1!7; // point to the 7eme column of the active workbook
range r2 = [Result]1!;
colcopy irng:=r1 orng:=r2; // Copy this column over.
}

jasonzhao

China
262 Posts

Posted - 03/16/2016 :  04:50:25 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

Please try the code in this way:

//
i=1;
doc -ef W {
range r1 = [%H]1!7; // point to the column of the active workbook
range r2 = [Result]1!col($(i));
r2=r1;
i++;
}

Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 03/16/2016 04:51:37 AM
Go to Top of Page

Bigprophete

France
20 Posts

Posted - 03/16/2016 :  05:08:14 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thanks,
It works but I still have a small problem, for example if I have 5 workbooks, it returns 6 values. For example the value of the workbook 4 is copied two times, then, if I delete the workbook "result" and run the code again, the value added corresponds to the workbook 5 (the increment is +1...)

Mathias
Go to Top of Page

jasonzhao

China
262 Posts

Posted - 03/16/2016 :  05:45:34 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hello,

You can exclude the workbook Result in the loop;

i=1;
doc -ef W {
if (%H=="Result")
continue;
range r1 = [%H]1!3; // point to the 7eme column of the active workbook
range r2 = [Result]1!col($(i));
r2=r1;
i++;
}



Best regards!
Jason
OriginLab Technical Service

Edited by - jasonzhao on 03/16/2016 05:46:44 AM
Go to Top of Page

Bigprophete

France
20 Posts

Posted - 03/16/2016 :  06:01:16 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It works !
Thank you very much

Mathias
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