Indentation to programming is essential for reading and debugging code.
- Indent after the Sub statements until the End Sub.
- Indent after the Function statements until the End Function statement.
- Indent after the FOR statement until the Next statement.
- Indent after the If statement until the End IF statement.
The following shows the above conventions.
Sub CLOSE_BOOKS() For Each BOOK In Workbooks If Left(UCase(BOOK.NAME), 4) = "BOOK" Then BOOK.Saved = True BOOK.Close End If Next End Sub