Excel - (Select|Selection)

Card Puncher Data Processing


The macro recorder will often create a macro that uses the Select method and the Selection property but in Visual Basic, it is usually not necessary to select cells before modifying them.



The Select method activates sheets and objects on sheets.

Select works only on the active worksheet.


The Selection property returns an object that represents the current selection on the active sheet in the active workbook.

Before you can use the Selection property successfully, you must:

  • activate a workbook,
  • activate or select a sheet,
  • and then select a range (or other object) using the Select method.


Macro Example with (Activation|Selection)

Sub Macro1() 
    ActiveCell.FormulaR1C1 = "Name" 
    ActiveCell.FormulaR1C1 = "Address" 
    Selection.Font.Bold = True 
End Sub

Same Example without (Activation|Selection)

Sub Labels() 
    With Worksheets("Sheet1") 
        .Range("A1") = "Name" 
        .Range("B1") = "Address" 
        .Range("A1:B1").Font.Bold = True 
    End With 
End Sub


Discover More
Card Puncher Data Processing
Excel - ActiveCell

The ActiveCell property of a worksheet 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 Be careful to...
Card Puncher Data Processing
Excel - Cell

In Microsoft Excel, you usually select a cell (see active cell) or cells and then perform an action, such as formatting the cells or entering values in them. In Visual Basic, it is usually not necessary...
Card Puncher Data Processing
Excel VBA - (Active|Activate)

You can use the Activate method to activate a cell within a selection. There can be only one active cell, even when a range of cells is selected. The following procedure selects a range and then activates...
Card Puncher Data Processing
Excel VBA - Range

Range represents: a cell, a row, a column, a selection|selection of cells containing one or more contiguous blocks of cells, or a 3-D range. Range property: If you use a text argument...

Share this page:
Follow us:
Task Runner