Mega Code Archive

 
Categories / VisualBasic Script / Excel
 

When you need to step through several objects in a collection, use a loop and a looping variable to represent the index of the objec

Sub saveWorkbook()     For I = 1 To 3           If Workbooks(I).Saved = True Then Workbooks(I).Close     Next I End Sub