Question

In: Computer Science

Sub HW4_1_1() 'a. Using the properties window in the VB editor assign ' the code name...

Sub HW4_1_1()

'a. Using the properties window in the VB editor assign
' the code name wsEx2 to the sheet with tab name Sheet1.
'b. Using VBA code and the code name for worksheet Sheet1,
' make this worksheet the active sheet.
'c. Declare a range variable and assign to this variable
' the range from A2 to A10 in the worksheet Sheet1.
'd. Write VBA code to create a range name and call it “Scores”.
' This range name should refer to the range B6to B14 in
' the worksheet labeled Sheet2
'e. Write VBA code that uses an Excel worksheet function
' that calculates the weighted average score (i.e.,
' the dot product of the range defined in part c. and the range in part d.
' and place the calculated value in cell A12 of the Sheet1 worksheet.
'f. Using VBA code change the background color of cell A12 to green.
'g. Using VBA code change the font type in cell A12 to italic and bold.
'h. Using VBA code change the format property of cell A12 so that
' it is displayed as a number with exactly three digits to the right
' of the decimal point and at least three digits to the left of the decimal point.

End Sub

Solutions

Expert Solution

Solution:

..........................................................................................................................................................

VBA CODE:

Sub wxEx2()

'''''' Question b''''''''
' Making the sheet active
wsEx2.Activate

'''''' Question c''''''''
' Setting range
Dim r1, Scores As Range
Set r1 = Sheets("Problem 2").Range("A2:A10")

'''''' Question d''''''''
' Set range Scores
Set Scores = Sheets("Problem 3").Range("B6:B14")

'''''' Question e''''''''
' Weighted average
Dim val As Double
Sheets("Problem 2").Range("A12").Value = Application.WorksheetFunction.SumProduct(r1, Scores) / Application.WorksheetFunction.Sum(Scores)

'''''' Question f''''''''
' Chane background color
Sheets("Problem 2").Range("A12").Interior.ColorIndex = 4

'''''' Question g''''''''
' Make italic bold
Sheets("Problem 2").Range("A12").Font.Bold = True
Sheets("Problem 2").Range("A12").Font.Italic = True
End Sub


Related Solutions

A text editor window should pop up with the following source code (except with your actual name):
  A text editor window should pop up with the following source code (except with your actual name): csci1011.lab8;/**** @author Your Name*/public class Account {} Implement the Account class. Add a public enum called ACCOUNT_TYPE with two values CHECKING, SAVING Add the following private instance variables to the Account class: An instance variable called aType of type Enum ACCOUNT_TYPE. An instance variable called accountOwner of type String. An instance variable called interestRate of type double. An instance variable called balance...
Write a code using c# Maximum Sub Array.
Write a code using c# Maximum Sub Array.
In linux , Using a simple text editor, create a text file with the following name...
In linux , Using a simple text editor, create a text file with the following name "Test" and content: GNU GENERAL PUBLIC LICENSE The GNU General Public License is a free, copy left license for the GNU General Public License is intended to guarantee your freedom to GNU General Public License for most of our software; it applies … 2-Write the command to create the text file. 3-Print the file permissions. 4-Create a directory named "361" 5-Copy file "Test" to...
Not: The number of elements, attributes, classes, properties, and sub properties will be assessed comparing to...
Not: The number of elements, attributes, classes, properties, and sub properties will be assessed comparing to your respective domains (website) and not according to the respective numbers 40, 20,60,30,15: given for reference of level. 10 queries Task: Think and define the domain of your interest: Put the link of the website/ domain. Write XML document: Point out at least 40 terms (elements) in your domain Point out at least 20 attributes in your domain Define an XML schema by using...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program,...
MATLAB: Write as a script in the editor window of matlab. Quadratic roots. Write a program, quadroots.m, for finding the roots of the second- order polynomial ax2 + bx + c. Use the quadratic equation. The inputs are the coefficients a,b, and c and the outputs are z1 and z2. The program should produce (exactly) the following output in the Command window when run with (a, b, c) = (1, 2, −3):
Using C#: Write a class named Employee that has the following properties: Name - The Name...
Using C#: Write a class named Employee that has the following properties: Name - The Name property holds the employee's name IdNumber - The IdNumber property holds the employee's ID number Department - The Department property holds the name of the department in which the employee works Position - The Position property holds the employee's job title The class should have the following overloaded constructors: A constructor that accepts the following values as arguments and assigns them to the appropriate...
Question: Using this code as a starting point, restructure the solution so that each sub-task (there...
Question: Using this code as a starting point, restructure the solution so that each sub-task (there are three) is performed in its own, separate function. When done, the function toDecimal should (1) do none of the actual "work" itself and (2) should call three separate functions in an appropriate order to complete the conversion process. This is similar to the work you did in exercise 6.4 (cengage mindtap) to restructure function newton. However, there is no recursion involved in this...
Linux Basics 1.In Linux what is a Window Manager –name a window manager that is commonly...
Linux Basics 1.In Linux what is a Window Manager –name a window manager that is commonly used? 2.If you were in a organisation that wanted to run a commercially backed distribution of Linux which one would you pick? 3.After the kernel is invoked at boot time, describe what happens? 4.Why is it common practice to use a boot loader? 5.Name two loaders used in Linux? 6.What is systemd? How is it used? 7.What does systemdreplace? Why was the choice made...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. DebugBox.java public class DebugBox { private int width; private int length; private int height; public DebugBox() { length = 1; width = 1; height = 1; } public DebugBox(int width, int length, height) { width = width; length = length; height =...
The files provided in the code editor to the right contain syntax and/or logic errors. In...
The files provided in the code editor to the right contain syntax and/or logic errors. In each case, determine and fix the problem, remove all syntax and coding errors, and run the program to ensure it works properly. Please Fix code and make Copy/Paste avaliable // Application allows user to enter a series of words // and displays them in reverse order import java.util.*; public class DebugEight4 {    public static void main(String[] args)    {       Scanner input = new Scanner(System.in);       int...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT