Skip to content
本页内容

Move (方法)

将工作表移到工作簿中的其他位置。

说明

如果既不指定 Before 也不指定 After,ET 将新建一个工作簿,其中包含所移动的工作表。

参数

属性数据类型必填说明
BeforeAny可选在其之前放置移动工作表的工作表。如果指定了 After,则不能指定 Before。
AfterAny可选在其之后放置移动工作表的工作表。如果指定了 Before,则不能指定 After。

示例

python
#此示例将当前活动工作簿的 Sheet1 移到 Sheet3 之后
def test():
    Application.Worksheets.Item("Sheet1").Move(None, Application.Worksheets.Item("Sheet3"))
python
#本示例判断如果工作表数量大于1,则将 Sheet2 移到 Sheet1 之前
def test():
    if Worksheets.Count > 1:
        Worksheets.Item("Sheet2").Move(Application.Worksheets.Item("Sheet1"))