View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Tim Williams Tim Williams is offline
external usenet poster
 
Posts: 1,588
Default Test for end of array of objects?

Whatever you're iterating through probably has a "count" property, so
you could try using a counter and checking to see if you're on the
last item.

Or just keep a reference to the last object and use it once you're out
of the loop.

Tim.


"peter" wrote in message
...

If I'm looping thru an array of objects with 'For Each',
how do I test for the last good one?

If I test for "" or 0, it says "not supported"

If I test for Nothing, it says "invalid use of object"

Thanks,
Peter.

(Excel VBA under XP)


*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!