Take a look at this reference for VBScript for the For/Each/Next statement.
http://msdn.microsoft.com/en-us/library/tywtbxd0
http://msdn.microsoft.com/en-us/library/tywtbxd0