# 3.6.4.6 CheckWksSelection

Checks to see if you have selected all or part of a single Z column in the active worksheet. If not, an error message is printed to a message box. If so, it sets the variables nZcol, nYcol, and nXcol to their respective column number designations.

## Definition:

Def CheckWksSelection {

if (wks.c1!=wks.c2 || wks.c1==0 || wks.col\$(wks.c2).type!=6) {
type -b "You must select exactly one Z column";
break 1;
};
nZCol=wks.c2;   // z col is selected z col
nYCol=%(%H,@Y-,wks.c2);
// y col is immediately to left of z col
nXCol=%(%H,@X,nYCol);
// x col is first x col in worksheet
};

## Example:

Given an active worksheet window with columns A(X1), B(X2), C(Y2), D(Y2), and E(Z2), the following script sets the variable nZcol equal to 5, nYcol equal to 4, and nXcol equal to 1.

CheckWksSelection;