Link Search Menu Expand Document

SSpread.SwapRange Method

Explanation Replaces the data and format of the specified cell range with other cell ranges.

Swap the data and formats in the cell blocks. The cell to be replaced will be replaced in the same range as the cell block to be replaced.

Use the SwapColRange method to swap column ranges and the SwapRowRange method to swap row ranges. Cell blocks can be copied and moved using the CopyRange and MoveRange methods.
Call format SwapRange(col, col2, row2, coldest, rowdest)
Return value None
Arguments col Column number of the upper left cell of the cell range of the replacement source
row Row number of the upper left cell of the cell range of the replacement source
col2 Column number of the lower right cell of the cell range of the replacement source
row2 Row number of the lower right cell of the cell range of the replacement source
coldest Column number of the upper left cell of the replacement destination cell range
rowdest The row number of the upper left cell of the cell range to be replaced
Exception EXT-28 An error occurred in the SwapRange method
Example of use
    BlockMode = $TRUE;
    Col = 2;
    Row = 2;
    Col2 = 4;
    Row2 = 4;
    Text = "sample";
    BackColor = $GREEN;
    Col = 6;
    Row = 6;
    Col2 = 8;
    Row2 = 8;
    Text = "sample2";
    BackColor = $RED;
    BlockMode = $FALSE;
    
    SwapRange(2, 2, 3, 3, 6, 6);
    
Related item ClearRange, CopyRange, MoveRange, SwapColRange, SwapRowRange methods