Homework 5

The Simple Financial Calculator (Part III)

This homework focuses on procedures ("macros" is the old term, "Sub" and "Function" the new terms). Specifically, you will make your existing H4 code more modular, which is a best practice. Benefits of this practice include: increased reuse of the modules, fewer errors, and faster changes. In so doing, you will also learn about subs, functions and parameters.

Make a copy of your own (or somebody else's) H4. Make sure that it works as expected. Then make the following changes:

  • Turn the do...loops that gather inputs from the user into separate functions
  • Create and use a sub that formats a table header and changes the interior color of a range of cells (alternating bands). The sub needs two arguments: the topLeft cell and the bottomRight cell

Follow the vLab and complete on your own as necessary.

Notes

- Extra credit (+0.5 points) to the first person who finds any mistake in the vLabs. Email timestamp will tell. Alternative ways of doing things do not count as errors.

- If you want to automatically set the width of columns, use the following

Columns("C:D").Select()
Application.Selection.Columns.AutoFit()