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
 Copying specific columns from multiple worksheets
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

Clairepibro

Canada
2 Posts

Posted - 08/09/2017 :  5:38:37 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin):
Operating System:

Hello,

I am a very beginner using Labtalk within origin.
I seem to be running into syntax issues.

I have workbook with 100-500 worksheets.

I would like to copy the 2nd column from each worksheet to a new worksheet ( or book), such that they are consolidated in the right order to 1 sheet.

Thank you in advance for your help!!!

new user

yuki_wu

896 Posts

Posted - 08/10/2017 :  01:58:58 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Let’s take an example. It is supposed that we have a workbook named Book1, and now we copy the second column in every sheet of Book1 to Book2:


win -a "Book1"; //Activate workbook, Book1
// Loop over all worksheets in Book1
loop(ii,1,page.nlayers)
{
	range rW = [Book1]$(ii)!col(2);
	// Copy the second column in the current worksheet to [Book2]Sheet1!
	colcopy irng:=rW orng:=[Book2]Sheet1!col($(ii));
}


For the detailed explanation of the associated syntax, please refer to these help file pages:
http://www.originlab.com/doc/X-Function/ref/colcopy
http://www.originlab.com/doc/LabTalk/ref/Loop-cmd
http://www.originlab.com/doc/LabTalk/guide/Looping-Over-objs

Hope it helps.

Regards,
Yuki
OriginLab

Edited by - yuki_wu on 08/10/2017 02:41:25 AM
Go to Top of Page

Clairepibro

Canada
2 Posts

Posted - 08/10/2017 :  11:28:37 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Thanks very much for your help Yuki that worked perfectly!

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