The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

Working with the Active Cell

Office 2007

The ActiveCell property returns a Range object that represents the cell that is active. You can apply any of the properties or methods of a Range object to the active cell, as in the following example.

Sub SetValue()
    ActiveCell.Value = 35
End Sub
Bb211461.vs_note(en-us,office.12).gif  Note
You can work with the active cell only when the worksheet that it is on is the active sheet.

Moving the Active Cell

You can use the Activate method to designate which cell is the active cell. For example, the following procedure makes B5 the active cell and then formats it as bold.

Sub SetActive()
    ActiveCell.Font.Bold = True
End Sub
Bb211461.vs_note(en-us,office.12).gif  Note
To select a range of cells, use the Select method. To make a single cell the active cell, use the Activate method.

You can use the Offset property to move the active cell. The following procedure inserts text into the active cell in the selected range and then moves the active cell one cell to the right without changing the selection.

Sub MoveActive()
    ActiveCell.Value = "Monthly Totals"
    ActiveCell.Offset(0, 1).Activate
End Sub

Selecting the Cells Surrounding the Active Cell

The CurrentRegion property returns a range of cells bounded by blank rows and columns. In the following example, the selection is expanded to include the cells adjoining the active cell that contain data. This range is then formatted with the Currency style.

Sub Region()
    Selection.Style = "Currency"
End Sub