Column: Move Columns
Move selected columns
1. colmove rng:=col(1) operation:=last;
2. colmove rng:=col(2):col(4) operation:=first;
3. colmove rng:=col(3) operation:=left;
4. colmove rng:=col(2) operation:=right;
5. colmove rng:=col(3) operation:=pos col:=col(2);
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 |
---|---|---|---|---|
Column(s) | rng |
Input/Output Range |
|
Specifies the column(s) to be moved. |
Operation | operation |
Input int |
|
Specifies the operation to execute on the columns.
|
Specific Column | col |
Input Column |
|
This is only available when the operation variable is set to pos (Move Before Specific Column). It is used to specify the target column position to be moved to. |
This X-Function moves the specified columns to new positions in the same worksheet, allowing user to rearrange the columns.
// colmove can be used to reorder columns by moving a column left or right or to the first or last column // Here we will reverse the order of columns ABCDE to EDCBA newbook; wks.ncols=5; colmove rng:=5 operation:=first; colmove r:=2 o:=last; colmove r:=2 o:=right; colmove r:=4 o:=left; colmove r:=3 o:=left;