MIS 462 Summer2022 Summative Assignment

Email Address: First Name: Last Name:
Semester: Class: StarID:
Section: Assignment:  

550 points

Visual Basic for Applications-VBA, Introduction, Chapters 1 to 3

Do all of these problems in a single Excel Workbook.
Solve each problem on a separate Worksheet.
Your Excel File must be setup like you did in Formative01 with appropriate Worksheet tab names.

(200) When done, upload your file, named Summative07.xlsm, (this is to be a Macro-Enabled workbook) to the D2L Assignment Folder 'Summative07'.

Before beginning this homework, you are strongly advised to first read Chapters 1 to 3.

Chapters 2 and 3, Introducing VBA

Recording Macros

Chapter 2- The Macro Recorder is explained in this chapter.
Learning to use the Macro Recorder can save you a lot of time learning how to program in VBA. Follow the directions and record the macro described in this chapter which adds your name to a cell.
Then record a macro that sets the page orientation to Landscape.
Open the VBA IDE and view the Code Module.

(75) 1. Provide a copy of the first 10 lines of your macro code below.

Note that there is a lot of code required to set the page to Landscape.
But a lot of the code is superfluous, and does not add any value.
Research how to 'comment out' code-see Chapter 3, and search the Internet, and comment out unnecessary lines of code, but make sure your macro still functions.

(25) 2. Briefly describe the mechanism to comment out lines of code.

(50) 3. Briefly describe why it is better to comment out lines of code rather than deleting lines of code.
Hint: what happens if something were to happen requiring you to revert to an earlier version of your code?

Simple macros

Write a macro which will do the following:

(50) 4. Copy and paste the resulting text in the space below.
Note you will loose points for unnecessary code.


Review Objects and Collections in the VBA help menu.
If necessary use Google or the Internet to research, review and answer the following questions.

(50) 5. Briefly describe what the following VBA code does to a worksheet:
Range("E10").Formula = "=RAND() * 10"

(50) 6. Briefly describe what the following VBA code does to a worksheet:
Range("A2, A4, A6, A8, A10") = 745

(50) 7. Briefly describe the purpose of the Object Browser: