Skip to content

Latest commit

 

History

History
53 lines (32 loc) · 1.52 KB

Excel.Application.Cells.md

File metadata and controls

53 lines (32 loc) · 1.52 KB
title keywords f1_keywords api_name ms.assetid ms.date ms.localizationpriority
Application.Cells property (Excel)
vbaxl10.chm183085
vbaxl10.chm183085
Excel.Application.Cells
9788c893-13c3-eb57-bcf7-50806b476ba3
04/04/2019
medium

Application.Cells property (Excel)

Returns a Range object that represents all the cells on the active worksheet. If the active document is not a worksheet, this property fails.

Syntax

expression.Cells

expression A variable that represents an Application object.

Remarks

Because the Item property is the default property for the Range object, you can specify the row and column index immediately after the Cells keyword. For more information, see the Item property and the examples for this topic.

Using this property without an object qualifier returns a Range object that represents all the cells on the active worksheet.

Example

This example looks at data in each row and inserts a blank row each time the value in column A changes.

Sub ChangeInsertRows()
    Application.ScreenUpdating = False
    Dim xRow As Long
    
    For xRow = Application.Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1
        If Application.Cells(xRow, 1).Value <> Application.Cells(xRow - 1, 1).Value Then Rows(xRow).Resize(1).Insert
    Next xRow
    
    Application.ScreenUpdating = True
End Sub

[!includeSupport and feedback]