Activate Method

Applies To

Chart object, ChartObject object, OLEFormat object, OLEObject object, Pane object, Range object, Window object, Workbook object, Worksheet object.

Description

Activates the object, as shown in the following table.

Object

Description

Chart, ChartObject

Makes this chart the active chart.

Worksheet

Makes this sheet the active sheet. Equivalent to clicking the sheet's tab.

OLEObject

Activates the object.

Pane

Activates the pane. If the pane isn't in the active window, the window that the pane belongs to will also be activated. You cannot activate a frozen pane.

Range

Activates a single cell, which must be inside the current selection. To select a range of cells, use the Select method.

Window

Brings the window to the front of the z-order. This won't run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).

Workbook

Activates the first window associated with the workbook. This won't run any Auto_Activate or Auto_Deactivate macros that might be attached to the workbook (use the RunAutoMacros method to run those macros).


Syntax

expression.Activate

expression Required. An expression that returns an object in the Applies To list.

See Also

RunAutoMacros method, Select method.

Example

This example activates Sheet1.

Worksheets("Sheet1").Activate
This example selects cells A1:C3 on Sheet1 and then makes cell B2 the active cell.

Worksheets("Sheet1").Activate
Range("A1:C3").Select
Range("B2").Activate
This example activates Book4.xls. If Book4.xls has multiple windows, the example activates the first window, Book4.xls:1.

Workbooks("BOOK4.XLS").Activate