2.14.7 get_wks_sel

Brief Information

Get cell selection in worksheet

Additional Information

X-Function not designed for Auto GetN Dialog.


Command Line Usage

get_wks_sel str:=selection; // select some columns or cells and then execute

Variables

Display
Name
Variable
Name
I/O
and
Type
Default
Value
Description
str

Output

string

sel
Variable holds the output string with selections in the worksheet. If there are no selections, this string will be empty.
sep

Input

string

|
Character to separate non-contiguous selections.
wks

Input

Worksheet

<active>
Worksheet to get the selections from.

Description

This X-Function gets range strings for selections made in the specified worksheet, and outputs the result to a string variable. When there are multiple, non-contiguous selections, the ranges will be separated by the specified separator.

Examples

Start with a worksheet and select some columns or range of cells. For non-contiguous selections, hold the CTRL key. Then run this script:

get_wks_sel; // selection gets saved to sel$
int nn=sel.GetNumTokens('|');  // count number of selections
for(int ii = 1; ii <=nn; ii++)
{
	strTemp$ = sel.GetToken(ii, '|')$; // get the next selection
	type Selection# $(ii): %(strTemp$); // type out selection range
}