For Each can only iterate over a collection object or an array
The For Each construct can only be used with collections and arrays. This error has the following cause and solution:
- You specified an object that isn't a collection or array as the group part of the For Each syntax. Check the spelling of the item over which you want to iterate to make sure it corresponds to a collection or array in scope in this part of your code.
For additional information, select the item in question and press F1 (in Windows) or HELP (on the Macintosh).
Support and feedback
Have questions or feedback about Office VBA or this documentation? Please see Office VBA support and feedback for guidance about the ways you can receive support and provide feedback.