Visual Basic for Applications/Loops

This lesson introduces loops.

Objectives and Skills
Objectives and skills for loops include:
 * Performing operations repetitively by using a Visual Basic Do...Loop structure
 * Performing operations repetitively by using Visual Basic For...Next and For Each...Next structures

Readings

 * 1)  Control flow
 * 2) Microsoft: Do...Loop Statement
 * 3) Microsoft: For...Next Statement

Activities
In these activities you will create macros that use input boxes to obtain user input, variables, conditions, and loops to perform calculations, and message boxes to display results. Your macros should include Option Explicit, Dim, InputBox, MsgBox, titles on the dialog boxes, an icon on the message box, and use appropriate data types for your variables.
 * 1) Average Calculation
 * 2) Create a macro that asks the user to enter grade scores. Start by asking the user how many scores they would like to enter. Then use a loop to request each score and add it to a total. Finally, calculate and display the average for the entered scores.
 * 3) Revise the script several times to compare the code required when the loop control structure is based on While, Do While, Do Until, and For Next statements, respectively.
 * 4) Multiplication Table
 * 5) Review MathsIsFun: 10x Printable Multiplication Table.
 * 6) Create a macro that uses nested for loops to generate a multiplication table. Rather than simply creating a 10 by 10 table, ask the user to enter the starting and ending values.
 * 7) Multiplication Table with Conditions
 * 8) Review MathsIsFun: 10x Printable Multiplication Table.
 * 9) Create a script that uses nested for loops to generate a multiplication table. Use a condition with ( Mod 2) to test for odd or even values. Generate the multiplication table only for even values. For odd values, skip display and continue to the next iteration of the loop.
 * 10) Multiplication Table with User Input
 * 11) Review MathsIsFun: 10x Printable Multiplication Table.
 * 12) Create a script that uses nested for loops to generate a multiplication table. Rather than simply creating a 10 by 10 table, ask the user to enter the starting and ending values. Use an Exit Do / Exit For statement to terminate the loop if the count exceeds 10.