Question
ON VBA Write a macro that asks for the number of gadgets needed using an input box and assign the value to a String variable.
ON VBA 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 Stringvariable. 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 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 (vbCritical or vbInformation) 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.
HELP WITH CODE
Turn in your Excel file with the code and a worksheet named boxes with the input boxes asking for the input numbers and the message boxes showing the results for different responses (use
Step by Step Solution
There are 3 Steps involved in it
Step: 1
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