Collection Vs Array
Arrays and collections both can be used to store data, however they have several notable differences:
Collection |
Array |
---|---|
It is a single dimension. | It is multidimensional. |
Independent of size. | Depend on size. |
Values can’t be changed once it is added to the collection. | Values can be changed. |
Additional functions like add, delete, and count. | No such additional functions. |
VBA Collections in Excel
An object that can store a number of values whether it can be of string data type or integer which can be easily manipulated or iterated is called Collection. In Excel VBA we should declare it as a new collection. It is an unchangeable, one-dimensional entity, unaffected by size adjustments. This immutable nature implies that alternations are