EXCEL VBA
- ABC company gives discount as follows:
Purchase > $400Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Discount rate = 5%
Purchase between $300 and$400Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Discount rate = 4%
Purchase >= $100 and <$300Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Discount rate = 2%
Purchase <100Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â No discount
Purchase = Price * Quantity
Discount = Purchase * Discountrate                                   Â
Net Purchase = Purchase – Discount
Total Net Purchase is the runningtotal of Net Purchases
Create a user interface form as shown below. Use text boxes toinput price and quantity. Use labels to display the discount, netpurchase (purchase amount after discount) and total net purchases.Click calculate button to calculate and display discount, netpurchase, and total net purchases; click clear button to clearvalues from the text boxes and labels, except total net purchases;send the focus to the price text box.
Click exit button to end the application.
- Create a sub procedure in a module to calculate:
a) the sum of even integers from 4 to 12 using DO WHILE. Displaythe sum in the message box. Name the sub procedure as Q2a.
b) the sum of odd integers from 5 to 9 using FOR NEXT. Display thesum in message box. Name the sub procedure as Q2b.
- Create a sub procedure named as Question3 in a module tocalculate the value and total value of items using a Do/while Loop.Value = Price * Quantity. Total value is the running total ofvalues. Use INPUTBOX function to get the price and quantity.Display the value in the message box. Display total value in themessage box after exiting the loop. Loop is entered by inputting“Y†at the prompt “Do you wish to continue?†and exited by entering“N†at the prompt “Do you wish to continue?â€
- Create a sub procedure named as Question4 in a module to findthe capital. Use INPUTBOX function to get the state and message boxfunction to display the capital.
State               Capital
MNÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â St.Paul
WIÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Madison
TXÂ Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Austin