Class Ranges (Excel VBA)

A collection of Range objects. To use a Ranges class variable it first needs to be instantiated, for example


Dim rngs as Ranges
Set rngs = ActiveWorkbook.Connections(1).Ranges

Count

Returns the number of objects in the collection.


Dim lngCount As Long
lngCount = ActiveWorkbook.Connections(1).Ranges.Count

Item

Returns a Range object that represents a range of items in a workbook.

Item (Index)

Index: The index value of the range item.


Dim rngItem As Range
Set rngItem = ActiveWorkbook.Connections(1).Ranges(Index:=1)