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 columns from one worksheet to another

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
Nick.Thissen Posted - 11/15/2011 : 1:12:47 PM
Hi,

I am quite new to Origin scripting / programming, but I've already managed to get a couple things up and running such as creating workbooks and worksheets.

Now the next step requires me to copy some data from one worksheet to another worksheet (in a different workbook). I need to create the workbooks and worksheets in the script too (but as I said I know how to do that, using 'newbook' and 'newsheet').
What I can't figure out is how to copy entire columns of data from one worksheet to another.


Suppose I have one large workbook called "master_workbook" with a large number of worksheets called "sheet1" to "sheet15". Suppose also I just created a new workbook called "WB3", and in that a new worksheet called "data" (ignore the default worksheet for the moment):
newbook WB3;
newsheet name:="data";


How do I now copy the data in column C of "sheet13" in workbook "master_workbook" to column A of my newly created "data" worksheet in workbook "WB3" ?

This greatly simplifies what I need to do, obviously (otherwise I'd do it manually), but if I can just figure this step out I'm sure I can get the rest myself.

So all I need is to know how I can copy the data from one column in one worksheet to another column in another worksheet (and in another workbook), assuming I have all these:
- the name of the source workbook (master_workbook)
- the name of the source worksheet (sheet13)
- the name of the source column (C)
- the name of the destination workbook (WB3)
- the name of the destination worksheet (data)
- the name of the destination column (A)


This should not be very hard, right? I can't find much help on "copying data" let alone from one worksheet to the other. Perhaps I'm using the wrong search terms... Can anyone assist me with this?

Thanks!
2   L A T E S T    R E P L I E S    (Newest First)
Nick.Thissen Posted - 11/16/2011 : 08:21:59 AM
Thanks, that works. What a strange syntax though, I would expect r1 and r2 to behave as variables and that "r2 = r1" would simply assign r1 to the variable r2 (thus 'erasing' r2), but this seems to be the step where the data is copied... Strange, but as long as it works :p

Thanks!
Sam Fang Posted - 11/16/2011 : 06:07:26 AM
You can use Origin's range. e.g
-------------------------------------------------------------------
range r1=[master_workbook]sheet13!col(C);
range r2=[WB3]data!col(A);
r2=r1;

-------------------------------------------------------------------

In fact Origin provides an X-Function wrcopy, it may be easier.

Sam
OriginLab Technical Services

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