MFIN 525 & OPIM 530 Assignment 1
Due: September 29 12:40 – Submit via SUCourse only Exercises – Not Graded You can only learn VBA by practicing, making mistakes, and correcting your mistakes. The exercises given below are from the textbook. Although they will not be graded (you are not required to submit them), you are strongly advised to do these exercises. 1) Chp. 3, Ex 1. Copying a module from one workbook to another. 2) Chp. 3, Ex 3. Using the Immediate window. Assignment Questions – To Be Graded 1) Based on (Chp. 3 Ex. 4) Insert a module into the given workbook and type the following code in the Code window.
Return to Sheet1 and add a button and assign the EnterUserNameSlowly macro to this button.
Run the program by clicking the button you have added. a) Explain what the code is doing in a particular cell of Sheet1. What would you do to slow down the typing of the username a bit more? b) Remove the “Dim datWaitTime as Date” line from the code. Try to run the program again. Now remove the “Option Explicit” line, and try to run the program again. Now add them both back to the code. Explain what “Option Explicit” does. c) Using the Object Browser find the help Excel Help entry for Wait. Using the information provided there, change the code so that, 5 seconds after the name has been typed in cell A3, a message box pops up with the message “Username entered.” (Hint: you can copy and paste a code from Excel Help.) 2) Recording and modifying macros. a) You are given closing prices for some of the stocks trading at the NASDAQ and NYSE stock exchanges, as well as the stock exchange composite indices. Record a macro where you use Excel Conditional Formatting tool, to format the daily percentage change of these stocks with the icon set “5 Arrows (Colored)” so that • Daily Change % >= 2.50 has upwards green arrow • Daily Change % >= 0.20 and < 2.50 has upwards