Write a macro that asks for the number of gadgets needed using an input box and
ID: 3787485 • Letter: W
Question
Write a macro that asks for the number of gadgets needed using an input box and assign the value to a string variable. Then have the macro ask through an input box for the amount of raw material needed to make one gadget and assign this value to a string variable. Furthermore, add another input box to ask for the amount of raw material available to manufacture gadgets and assign this number to a string variable. In your VBA code check that the number of gadgets needed, the amount of raw material needed to make a gadget, and the amount of raw material available are entered correctly (i.e., make sure that numbers were specified). If any one of the entries is not a number, print a message with an exclamation sign indicating that there was an error and terminate the macro. If the entries are numbers then assign the values in the string variables to integer and single variables as appropriate and calculate the number of gadgets that can be manufactured.
If the number of gadgets that can be manufactured is greater than or equal to the number of gadgets needed, display a message indicating the number of gadgets that can be manufactured indicating the demand can be met.
Otherwise display a message indicating that the raw material is not enough to manufacture the number of gadgets needed, inform the user the number of gadgets that can be manufactured with the available raw material and ask if the user wants to order the number of gadgets that can be made (do this with Yes/No buttons -- see sample below). If the user responds “Yes” then a box with the message “We will send you the # this week” will be displayed (see sample below). If the user responds “No” then then a box with the message “Please come back soon” will be displayed (see sample below). The message boxes do not have to have the exact same buttons but they should have a button. (See sample boxes below).
Place a command button on Sheet1 that calls your macro.
Make sure that some queries/prompts are displayed as in the samples shown here, use line continuation “_” in your code as needed and use indentation for clarity.
Explanation / Answer
In $
A
Particulars
Old
New
Differential
Income
Annual
Net
Annual
Net
Annual
Net
Depricitaion
(23,500)
(235,000)
(42,000)
(420,000)
(18,500)
(185,000)
Annual Variable Production Cost for 10 years
(7,500)
(75,000)
(3,900)
(39,000)
3,600
36,000
Proceeds from Old Machinery
-
-
-
90,000
-
90,000
Differential
(310,000)
(369,000)
(14,900)
(59,000)
B
Sunk Cost
$
Cost of New Equipment
420,000
Accumulated Depriciation
145,000
Total
565,000
In $
A
Particulars
Old
New
Differential
Income
Annual
Net
Annual
Net
Annual
Net
Depricitaion
(23,500)
(235,000)
(42,000)
(420,000)
(18,500)
(185,000)
Annual Variable Production Cost for 10 years
(7,500)
(75,000)
(3,900)
(39,000)
3,600
36,000
Proceeds from Old Machinery
-
-
-
90,000
-
90,000
Differential
(310,000)
(369,000)
(14,900)
(59,000)
B
Sunk Cost
$
Cost of New Equipment
420,000
Accumulated Depriciation
145,000
Total
565,000
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.