Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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 to place an image onto the clipboard and then to paste). (It may be easier if you first copy the boxes to a Word file and when you are done, then copy the boxes from the Word file back to the Excel file). The first line in your code should have Option Explicit and your second line should be a comment statement with your name. All variables used should be declared, the code should use indentation and include comment lines.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Pro SQL Server Wait Statistics

Authors: Enrico Van De Laar

1st Edition

1484211391, 9781484211397

More Books

Students also viewed these Databases questions

Question

Why do HCMSs exist? Do they change over time?

Answered: 1 week ago