Question: Problem 1 : Write an event handler for the second worksheet. When activated, a message box showing the time in minutes since midnight ( rounded

Problem 1:
Write an event handler for the second worksheet. When activated, a message box showing the
time in minutes since midnight (rounded down to an integer) and the worksheets name should
be displayed. (HINT: Dont hardcode the worksheet name use VBA to get the name. If the
name of the sheet is changed by the user, the message box should reflect that.)
Problem 2:
In module ModuleProblem2, write a function SumAbsDiff that takes 2 ranges as input and
gets the sum of absolute difference of every element if these two ranges have the same numbers
of elements. The function outputs string Error! if the size of these two ranges are different.
Hint: Use .cells(i) to get the ith element of a range
Place this function into the green cells on the first worksheet and use it the evaluate the absolute
difference of the blue and red cells. (You will have to do this twice: they are grouped by cell
borders.)
Problem 3:
The program in Example 9.2(Pgs 187 and 188) is written as a single sub. Break it into at least
three shorter subs, all called from a Main sub. You can decide how to break it up and whether
you want to use module-level variables or pass arguments. Input data is in worksheet Data.
ISEN 230: Homework Function and Event Handler
Due 10/28/2024
Problem 4: (Note: Save your code in module ModuleProblem4)
1. Write a function MyFunction which takes as input a range and an integer which
returns:
a. The sum of the range if the integer argument value is 1
b. The sum of squares of the range if the integer argument value is 2
c. The average of the range if the integer argument value is 3
d. Nothing if the integer argument value is anything else
2. Use VBA to place the function from part 1 in cell C1 on the worksheet A. First use input
boxes to take the input arguments. (Set the default value of the range argument to
a1:a20). A command button that calls this sub should be placed on worksheet A.
Hint: Use the .formula property
3. Write a sub which appends a random number (between 1 and 4 inclusive) of cells with a
random value (between 1 and 20 inclusive) to the end of the list of numbers in column A.
4. When the workbook is opened:
a. Select worksheet B
b. Call the sub from part 3

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!