Question
Write the VBA code for the following questions. Save your answers as an Excel Macro-Enabled Workbook with your name and ID (e.g. ahmad_alahmad_123456.xlsm). Please save
Write the VBA code for the following questions. Save your answers as an Excel Macro-Enabled Workbook with your name and ID (e.g. ahmad_alahmad_123456.xlsm). Please save your questions as different subs (e.g. Sub question1()). Upload your response to Moodle, through the Assignment link. Please notes that it is the students’ responsibility to save and upload their files properly. If your file cannot be viewed, or if you fail to upload or send your file on time, your grade will bezero.
Question 1:
Write VBA code for a program that accepts four values for Customer ID, Customer name, year of birth, and age from the user.
Set the value of Customer Id in cell A1 at the active sheet in the active workbook.
- Set the value of the Customer name in cell B1 at the active sheet in the active workbook.
- Set the value of a year of birth in cell C1 at the active sheet in the active workbook.
- Set the value of age in cell D1 at the active sheet in the active workbook.
- Make test in the range A1 to D1 to be red if the age is not correct, and green if the age is correct.
(age = 2021 - year of birth).
- Question 2:
Write VBA code for a program that reads two numbers from range A5 to B5 and displays the appropriate one of the following messages:
a. A5 < A5 value > is smaller than the B5
b. A5 < A5 value > is larger than the B5
c. Numbers are equal.
Question 3:
Write VBA code for a program for a gym subscription plan. Allow user to enter a number of months and the plan price. Assume that the user earns an extra five percent discount every month. The program output is a schedule that lists each month number in the gym subscription plan starting with month 1 and the user’s savings at that month.
Example:
The user entered 3 months gym subscription for the 120 KD plan.
The output:
- Month number 1 the discount percentage is 0% and the discount amount is 0KD
- Month number 2 the discount percentage is 5% and the discount amount is 6KD
- Month number 3 the discount percentage is 10% and the discount amount is 12kd
Step by Step Solution
3.48 Rating (151 Votes )
There are 3 Steps involved in it
Step: 1
Answer 1We are using InputBox to take input from the user and then placing the input in respective c...Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started