The partial worksheet shown below has been developed for course registration at
ID: 2478073 • Letter: T
Question
The partial worksheet shown below has been developed for course registration at a local community college. When the course number is placed in a cell in the A column, the other columns will display the appropriate information (the information is obtained by using VLOOKUP functions in the other columns).
Write the appropriate code to do the following:
Create a macro named Registration.
Use the Name Box to select the cell that has been named COURSE (assume that Cell A2 has been named COURSE).
Create one dialog box that will ask the user to enter the number of the course they wish to register for. Your code should place the user’s response in the appropriate cell in the A column – A2 for the first course, A3 for the second course, etc. (HINT: use relative referencing.). The title for this dialog box should be Number. Write the code for this dialog box, so it will be repeated if the course number entered is not greater than or equal to 30000 and less than or equal to 60000. Note that the description, days, time, location, instructor and credits will automatically appear based on the course number the user enters in the A column.
Write the code so it will loop 7 times so that each time a new course is entered, the course number is placed in column A on the next row down, allowing the user to enter up to 7 courses.
Assume that the total number of credit hours appears in Cell G8. If that total is 6 hours or less, create a message box telling the user their tuition is $2,500. If that total is between 6 and 12 hours, create a message box that tells the user their tuition is $4,500. If the total is 12 hours or more, your message should tell the user their tuition is $6,000.
Explanation / Answer
Sub Registration () Application : Go To Reference:="COURSE" Dim Counter As Integer Counter = 1 For Counter 1 To 7 Do ActiveCell.Value = InputBox("Enter the course number you want to register for" , "Course Number") Loop Until ActiveCell.Value30000 and ActiveCell.Value60000 ActiveCell.Offset(1,0). Select Next Counter If Range("G8").Value=6 Then MsgBox("Your tuitiion is $2,500) Elself Range("G8"). Value6 and Range ("G8").Value12 Then MsgBox("Your tuitiion is $4,500) Else MsgBox("Your tuitiion is $6,000) End If End Sub
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.