XLL+ Class Library (6.3)

CXlOper::Offset

Returns a reference moved by the specified number of rows and columns

CXlOper Offset(
   long nRows,
   long nCols
) const;

Parameters

nRows

Number of rows to move by (negative is up, positive is down).

nCols

Number of columns to move by (negative is left, positive is right).

Return Value

Returns a new reference, offset from this reference by the specified number of rows and columns. The function will throw an exception if the new reference is not valid.

Remarks

The function will throw an exception of type CXlBadOperTypeException if the object does not contain a single or multiple reference.

The function will throw an exception of type CXlOutOfRangeException if the new position would be out of range.

This method is a short-hand for getting a reference, moving it, and setting it. Thus, the following:

xlo2 = xlo1.Offset(0, 1);

is a short-hand for:

xlo2 = xlo1;
CXlRef xlr = xlo2.GetRef();
xlr.MoveBy(0, 1);
xlo2.SetRef(xlr);

Requirements

Header: xllplus.h

See Also

CXlOper Class | CXlOper Methods | CXlOper::Resize() | CXlOper::MoveRefBy()