Class Areas (Excel VBA)
A collection of the areas, or contiguous blocks of cells, within a selection. To use a Areas class variable it first needs to be instantiated, for example
Dim ars as Areas
Set ars = ActiveCell.Areas
For Each
Here is an example of processing the Areas items in a collection.
Dim rng As Range: Set rng =
Dim rngArea As Range
For Each rngArea In rng.Areas
With rngArea
End With
Next rngArea
Count
Returns a Long value that represents the number of objects in the collection.
Dim lngCount As Long
lngCount = ActiveCell.Areas.Count
Item
Returns a single object from a collection.
Item (Index)
Index: The index number of the object.
Dim rngItem As Range
Set rngItem = ActiveCell.Areas(Index:=1)