T O P I C R E V I E W |
paola.bolognesi |
Posted - 01/27/2011 : 11:54:45 AM Origin Ver. 7.5 SR7 Operating System: windows7
Hi, I would like to execute a LabTalk script on a range of worksheet data selected by highlighting the data from the worksheet (with mouse). For example, out of a huge worksheet, I need to select few rows of two adjacent columns, taking the weigthed average of data in the second selected column and using data in the first selected column as weigth.
However, I cannot find the labtalk command that returns the content of cells selected in such way.
Could you please help me with that ?
Many thanks Paola |
3 L A T E S T R E P L I E S (Newest First) |
greg |
Posted - 10/23/2012 : 09:26:40 AM There is an XFunction useful for getting complex range selections, unfortunately you don't have it in 8.1 and therefore would have to use OriginC for such selections.
Here is an example of the new XFunction: get_wks_sel str:=str sep:=| wks:=[Book1]Sheet1; str$ =; [Book1]Sheet1!2[1:6]|[Book1]Sheet1!3[6:10]|[Book1]Sheet1!4[10:14] |
zumix |
Posted - 10/19/2012 : 04:53:18 AM Hi guys. I'm using ver.8.1 I've come to this topic looking for how to loop over a selected range of worksheets inside a book. I select a few with crtl+mouse and then i want to apply a script to them. Is there anything as wks.c1 c2... for selected wks? Cheers |
greg |
Posted - 02/02/2011 : 3:33:49 PM The object properties you are looking for are wks.c1 First column number of selected range wks.c2 Last column number of selected range wks.r1 First row number of selected range wks.r2 Last row number of selected range
Here is an example that simply copies the data to new columns:
// BEGIN SCRIPT // Loop over all selected columns loop(iCol,wks.c1,wks.c2) { wks.addcol(Copy); // and loop over all selected rows for(RdRow=wks.r1,WrRow=1;RdRow<=wks.r2;RdRow++,WrRow++) { cell(WrRow,wks.ncols) = cell(RdRow,iCol); } } // END SCRIPT |