Rectangles Method

Applies To

Chart Object, DialogSheet Object, Worksheet Object.

Description

Accessor. Returns an object that represents a single rectangle (a Rectangle object, Syntax 1) or a collection of rectangles (a Rectangles object, Syntax 2) on the sheet. Read-only.

Syntax 1

object.Rectangles(index)

Syntax 2

object.Rectangles

object

Required. The object containing the rectangles.

index

Required for Syntax 1. The name or number of the rectangle.

Example

This example deletes every rectangle on Sheet1.


Worksheets("Sheet1").Rectangles.Delete

This example changes the color of rectangle one on Sheet1 to red.


Worksheets("Sheet1").Rectangles(1).Border.ColorIndex = 3