excel loops 7

profileCEEZEEF
tips_hw7.docx

Tips

Problem 5:  Write this as a Sub procedure (not Function), with a For-Next loop to calculate the beam deflection at each increment of x.  Store the x and y results in arrays during iterations of the loop.  Then use another For-Next loop to write the array values to a table on a spreadsheet for plotting.  You must show the table and plot on the worksheet, and the VBA module with the Sub procedure.

Problem 7:  Create a Function that accepts two integer arguments (a lower bound and an upper bound), and uses a For-Next loop to compute the sum of the numbers from the lower to the upper bound (e.g., 4+5+6+7, if the lower bound is 4 and the upper bound is 7).  Return that sum as the value of the function.  Also, program the function to compute the product of the numbers and the sum of the odd numbers in the same sequence, displaying these results in a MsgBox.  Hint:  Use the VBA "Mod" operator to determine if a number is odd.

Problem 21:  Create a Sub (not Function) that will calculate the sum, average, and standard deviation of data your user will enter in column A of a worksheet (starting in cell A1), write the results to worksheet cells.  Assume no gaps (empty cells) until the end of the column.  I don't need to see any work for Part C, but want to re-state Part D:  If the user enters less than 2 data points (i.e., cell A2 is empty), the Sub will display a MsgBox alerting that at least 2 data points are needed to perform the calculations, and will terminate with the first empty cell in column A selected.