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
 Forum for Origin C
 Copy one cell of a column/row to another sheet
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

cyndi.y.ri

USA
11 Posts

Posted - 02/21/2014 :  2:13:00 PM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Origin Ver. and Service Release (Select Help-->About Origin): OriginPro 9.0.0 (64-bit) SR2
Operating System: Windows

First off I want to say I am NOT a programmer. I only do this on an as needed basis.

I have several sheets in a book with 4 columns and one row of data (computed data in Origin). I need to take this data and place rows from each of the different sheets into one sheet of 4 columns and rows of the data to be able to plot. (or I think I do)

Example:

Sheet1

TotalLF / TotalRF / ToltalLP / TotalRP
.39 / .013 / 0 / 17

Sheet2

TotalLF / TotalRF / ToltalLP / TotalRP
.20 / .015 / 1 / 19

Sheet3

TotalLF / TotalRF / ToltalLP / TotalRP
.15 / .021 / 3 / 13

Into Sheet4

LeftFlow / RightFlow / LeftPressure / RightPressure
.39 / .013 / 0 / 17
.20 / .015 / 1 / 19
.15 / .021 / 3 / 13

Thanks for any help I can get.

greg

USA
1378 Posts

Posted - 02/25/2014 :  11:54:50 AM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
You do not need Origin C to do this since LabTalk is sufficient:

// BEGIN SCRIPT
range rap = [%H];
newsheet cols:=4;
col(1)[L]$ = LeftFlow;
col(2)[L]$ = RightFlow;
col(3)[L]$ = LeftPressure;
col(4)[L]$ = RighPressure;
loop(ii,1,rap.nlayers - 1)
{
wrcopy iw:=%(rap)$(ii)
ow:=!
c1:=1
c2:=4
r1:=1
r2:=1
dc1:=1
dr1:=$(ii);
}
// END SCRIPT

The script adds a newsheet to your workbook and copies one row of four columns of data from each of the pre-existing sheets to this new sheet.

With your Workbook active, copy and paste the script to the Command Window and press Enter.

If you need to copy more than one row from each sheet you need to modify the r2 argument (the number of rows to copy) and the dr1 argument (the destination for the next block of data).
Go to Top of Page

cyndi.y.ri

USA
11 Posts

Posted - 02/25/2014 :  12:14:59 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The first row of numbers came out correctly.

JUNE 2002 6/15/2002 0.39 0.13 0 17
3 1/1/2014 0 0 0 0
1 1/1/2014 0 0 0 0
1 1/1/2014 0 0 0 0
1 1/1/2014 0 0 0 0
1 1/1/2014 0 0 0 0
1 1/1/2014 0 0 0

as you can see the rest didn't.

I changed the script to the following to add a couple of rows...

// BEGIN SCRIPT
range rap = [%H];
newsheet cols:=6;
col(1)[L]$ = Label;
col(2)[L]$ = Date;
col(3)[L]$ = LeftFlow;
col(4)[L]$ = RightFlow;
col(5)[L]$ = LeftPressure;
col(6)[L]$ = RighPressure;
loop(ii,1,rap.nlayers - 1)
{
wrcopy iw:=%(rap)$(ii)
ow:=!
c1:=1
c2:=6
r1:=1
r2:=1
dc1:=1
dr1:=$(ii);
}
// END SCRIPT

Edited by - cyndi.y.ri on 02/25/2014 12:16:41 PM
Go to Top of Page

greg

USA
1378 Posts

Posted - 02/25/2014 :  12:52:47 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
It isn't clear from your post what's wrong. Maybe you should send your project file and script to tech at originlab.com.
By the way, there is an option to make sure the column format is copied as well
format:=1
Go to Top of Page

cyndi.y.ri

USA
11 Posts

Posted - 02/25/2014 :  1:31:20 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Thank You
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