Question

In: Computer Science

Create a new worksheet and name it as “Roster”. Assume that you are the TA for...

Create a new worksheet and name it as “Roster”. Assume that you are the TA for Mgtop 470. You have the class roster in the worksheet “Roster” and the full names of students are in column A, starting in Cell A3, with last name last and case insensitive (such as Ben ALT). Write a sub that counts the number of names in the list with last name ALT and then displays this count in an MsgBox that is titled “Number of ALTs” and has an Exclamation icon button. Note that there might be last names, such as DALT, which should not be counted.

Solutions

Expert Solution

The VBA code is given down below.

Option Explicit

Sub CountLastNames()
    ' Declarre the variables
    Dim count As Integer
    Dim i As Integer
    Dim fullName As String
    Dim lastName As String
    Dim nameParts() As String
    
    'The names in the Excel sheet starts from Row 3.  So hard code it.
    i = 3
    
    'Check if the cell is blank.  If blank exit the loop.  Otherwise it will loop continuously.
    'Assuming that after all the names are entered without any blank names.
    Do While (Cells(i, 1) <> "")
        'Extract the full name from the cell.  remove the spaces from both the ends, if any.
        fullName = Trim(Cells(i, 1))
        'split the full name it parts based on space.  This will store each part of the names into an array.
        nameParts = Split(fullName, " ")
        'extract the last member in the array which will be last name.
        lastName = nameParts(UBound(nameParts))
        'Remove any extra spaces
        lastName = Trim(lastName)
        
        'Check if the last name is "alt"
        'This is a case insensitive search
        If (LCase(lastName) = "alt") Then
            'If it matches, increment the counter.
            count = count + 1
        End If
        
        i = i + 1
    Loop
    
    'Display the information with the Messagebox title and Exclamation icon.
    MsgBox count, vbExclamation, "Number of ALTs"
End Sub

Screenshot


Related Solutions

Exercise 3: Create a worksheet that gives a price quote. You will select an item name...
Exercise 3: Create a worksheet that gives a price quote. You will select an item name and enter the quantity of that item purchased. Use Data Validation to create a drop down list for your item names. Your worksheet should look up the item name in the Price Table to find the Unit Price. Then it should calculate the Total Before Discount. Look up this amount in the Discount Table to find the discount percent. Then your worksheet should calculate...
Create a simple python app that allows the user to create a roster of students and...
Create a simple python app that allows the user to create a roster of students and their grade on CUS-1166. Moreover the app needs to calculate the average grade of students added to the roster. 1-To begin with, create a new file n the same working folder as part A (i.e. cus1166_lab1) and name it app.py. Moreover, create a subfolder and name it mymodules. 2-Within mymodules create the files __init__.py , models.py , math_utils.py . 3-In the models.py file define...
1. Start a new worksheet and name it Z-scores. Use the STANDARDIZE function in Excel to...
1. Start a new worksheet and name it Z-scores. Use the STANDARDIZE function in Excel to calculate the z-scores for problems 2 and 4 on page 401 and problems 2 and 4 on page 412. Read Examples T.3 and T.4 on page 422 to see examples of how to use STANDARDIZE with means and proportions. Your output should look like the partial worksheet at right, except that cells C3, C4, C9, and C10 should be filled with the correct z-scores...
Write a class Roster that is identified by the course name, course code, number of credits,...
Write a class Roster that is identified by the course name, course code, number of credits, instructor name, and contains a list of students stored in an array. For now you can use stack allocated array of MAX_CAPACITY=10 (define MAX_CAPACITY as a macro in the .h file). Later we will make this array dynamic to allow it to grow. Provide necessary constructors, accessor functions for each member, and mutator functions for each member. Provide a function to add a student...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt...
Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is 2,...
python Create a new file name condition_quiz.py. Add a comment with your name and the date....
python Create a new file name condition_quiz.py. Add a comment with your name and the date. Prompt the user to enter the cost. Convert the input to a float. Prompt the user for a status. Convert the status to an integer Compute the special_fee based on the status. If the status is 0, the special_fee will be 0.03 of the cost. Else if the status is 1, the special_fee will be 0.04 of the cost. Else if the status is...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create...
​​​​Python Create a new file named compute_cost.py. Write your name and date in a comment. Create a variable named base_fee and set the value to 5.5. Prompt the user for the zone. The zones can be an integer value from 1 to any value for the zone. Convert the zone to an integer. Display the zone on the SenseHat with a scroll speed of 0.3, make the text blue, and the background yellow. Scroll "The zone is " and the...
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project...
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project is to create a model for a production cost report using the weighted average method for the month of May.   Following good Excel design techniques, you should have an input area in which you put the department information for the month, and an output area that calculates the production cost report. As always, you should have only formulas or references in your output area....
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project...
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project is to create a model for a production cost report using the weighted average method for the month of May.   Following good Excel design techniques, you should have an input area in which you put the department information for the month, and an output area that calculates the production cost report. As always, you should have only formulas or references in your output area....
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project...
Process Cost Excel Project Create a new Excel spreadsheet and name it “Last name_PC”. You project is to create a model for a production cost report using the weighted average method for the month of May.   Following good Excel design techniques, you should have an input area in which you put the department information for the month, and an output area that calculates the production cost report. As always, you should have only formulas or references in your output area....
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT