Get cell selection in worksheet
X-Function not designed for Auto GetN Dialog.
get_wks_sel str:=selection; // select some columns or cells and then execute
Please refer to the page for additional option switches when accessing the x-function from script
Display Name |
Variable Name |
I/O and Type |
Default Value |
Description |
---|---|---|---|---|
str |
Output string |
|
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 |
|
Worksheet to get the selections from. |
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.
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 }