Question: Problem 4 : ( Note: Save your code in module ModuleProblem 4 ) 1 . Write a function MyFunction which takes as input a range

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!