For Each - Next
This gives you access to all the elements in an Array or Collection without knowing (or checking) exactly how many elements there are.
The data type of oItem must be Variant.
Elements in an Array
This loops through all the items in the array.
Elements in a Collection
This loops through all the items in the collection.
Exit For
The Exit For statement lets you exit the loop early.
© 2026 Better Solutions Limited. All Rights Reserved. © 2026 Better Solutions Limited TopPrevNext