Move Method

Applies To

Chart Object, Charts Collection, DialogSheet Object, DialogSheets Collection, Module Object, Modules Collection, Sheets Collection, ToolbarButton Object, Worksheet Object, Worksheets Collection.

Description

Syntax 1: Moves the sheet to another location in the workbook.

Syntax 2: Moves a toolbar button to another position, either on the same toolbar or to another toolbar.

Syntax 1

object.Move(before, after)

Syntax 2

object.Move(toolbar, before)

object

Required. The object to which this method applies.

before

Syntax 1: Optional. The sheet before which this sheet will be moved. You cannot specify before if you specify after.

Syntax 2: Required. Specifies the new button position as a number from 1 to the number of existing buttons + 1. Gaps count as one position. Buttons to the right of this position are moved right (or down) to make room for the moved button.

after

Optional. The sheet after which this sheet will be moved. You cannot specify after if you specify before.

toolbar

Required for Syntax 2. Specifies the toolbar object to move the button to.

Remarks

If you do not specify either before or after, Microsoft Excel creates a new workbook containing the moved sheet.

See Also

Copy Method.

Example

This example moves Sheet1 after Sheet3 in the active workbook.


Worksheets("Sheet1").Move _
    after:=Worksheets("Sheet3")