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
 Insert Rows into worksheet

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
peter.cook Posted - 10/16/2001 : 09:06:49 AM
Hi,

I'm trying to insert rows into a worksheet using LabTalk but no luck.
Any ideas (apart from cutting and pasting)?

Cheers,

Pete
3   L A T E S T    R E P L I E S    (Newest First)
peter.cook Posted - 11/02/2001 : 05:22:08 AM
Hi,

Mike - thanks for the reply. Nice code. This approach had crossed my mind but with the large sheets I'm involved with eg 40,000 rows speed would have been a problem. I wanted to add a new row. However, I might try adding this functionality to the MOCA worksheet dll for a bit of fun...!

Ryan - thanks as well. I keep forgetting the CTRL + SHIFT option! I'll use this approach for now and possibly use modified dll later.

Cheers,

Pete
rtoomey Posted - 10/18/2001 : 4:19:27 PM
Mike's response is great, but the time it takes to execute the script could be quite long. The shortcut is to use the menu ID. Here's some instructions.

I. First, determine the menu ID associated with Edit:Insert operation. To do that:

  1. Open the Script window by selecting Window:Script Window.

  2. Select a row heading in your worksheet.

  3. Hold down the CTRL + SHIFT keys on your keyboard and select Edit:Insert. A menu ID should be reported to the Script window.


II. Second, use that menu ID in a script similar to the following:

wo -s 1 4 2 6;
domenu 36441;


The script selects rows 4 thru 6 in columns 1 and 2 and inserts a row for each row selected.

Advantage: The menu ID approach is fast and easy.
Disadvantage: The menu ID can change between versions.
Bottom Line: Use whichever method you like best.

Hope this helps.

- Ryan



Mike Buess Posted - 10/16/2001 : 11:23:41 AM
This script will insert row nn1 from Data1 at the selected row in the active worksheet. It shifts all data in the active worksheet down a row first to make room for the new row. Of course all columns in the active worksheet must contain the same number of rows.
nn2=wks.r1;
get col(1) -e npt;
set %H -er (npt+1);
del tmp; tmp=data(nn2,npt);
loop (ii,1,wks.ncols) {
copy -b nn2 wcol(ii) tmp -b 1 -e (npt-nn2+1);
copy -b 1 tmp wcol(ii) -b (nn2+1) -e (npt+1);
wcol(ii)[nn2]=%(Data1,ii,nn1);
};
del tmp;
Is that the sort of thing you're looking for? It shouldn't be too hard to modify the script to insert multiple rows.

Mike Buess
Origin WebRing Member

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