Activate Method

Microsoft Office Web Components Object Model

Show All

Activate Method

       

Activate method as it applies to the Range object.

Activates a single cell. To select a range of cells, use the Select method.

expression.Activate

expression   Required. An expression that returns a Range object.

Activate method as it applies to the Worksheet object.

Activates the specified worksheet.

expression.Activate

expression   Required. An expression that returns a Worksheet object.

Example

As it applies to the Range object.

This example selects cells A1:C3 on the active worksheet and then makes cell B2 the active cell within the selection.

Sub Activate_Range()

   ' Select cells A1:C3 in the active worksheet.
   Spreadsheet1.ActiveSheet.Range("A1:C3").Select

   ' Select cell B2. The following line of code uses the Cells
   ' method to index the current selection. Cell B2 is in the
   ' second row and the second column of the current selection.
   Spreadsheet1.Selection.Cells(2, 2).Activate
End Sub

As it applies to the Worksheet object.

This example activates Sheet2 in Spreadsheet1.

Spreadsheet1.Worksheets("Sheet2").Activate