xlsmove()

Read(299) Label: xlsmove, sheet, excel,

Here’s how to use xlsmove() function.

xo.xlsmove()

Description:

Move a worksheet in an Excel object.

Syntax:

xo.xlsmove (s,s’;xo’)

Note:

The function moves a worksheet named s in Excel object xo to another Excel object xo’and rename it s'.

 

When xo’ is absent, the function renames worksheet s in Excel object xo s'. If parameter s' is also absent at the same time, just delete worksheet s.

 

When parameter xo’ is present but parameter s' is absent, worksheet s will continue to use the current name.

Parameter:

xo

Excel object

s

Sheet name in Excel object xo

s'

Sheet name

xo’

Excel object

Note:

@c

Copy

Return value:

None

Example:

 

A

 

1

=file("x1.xlsx").xlsopen()

Read x1.xlsx and return an Excel object:

2

=file("xx.xlsx").xlsopen()

Read xx.xlsx and return an Excel object:

3

=A1.xlsmove("s1","sh1";A2)

Move sheet s1 in x1.xlsx to xx.xlsx and rename it sh1; there is also sheet s2 in x1.xlsx:

xx.xlsx has sheet1 and sheet sh1:

4

=A1.xlsmove@c("s2","sh2";A2)

Copy sheet s1 in x1.xlsx to xx.xlsx and rename it sh2; now x1.xlsx also has sheet s2:

xx.xlsx has sheet1, sheet sh1 and sheet sh2:

5

=A1.xlsmove("s2","st2")

As parameter xo’ is absent, rename sheet s2 in x1.xlsx st2; below is structure of x1.xlsx:

6

=A2.xlsmove("sheet1")

As both parameter xo’ and parameter s' are absent, delete sheet1 in xx.xlsx; below is structure of xx.xlsx:

7

=A1.xlsmove@c("s2";A2)

As only parameter s' is absent, sheet s still uses its current name; and @ option enables copying sheet st2 in x1.xlsx to xx.xlsx; below is structure of xx.xlsx: