+ Reply to Thread
Results 1 to 3 of 3

Searching for a value with a do loop

  1. #1
    Registered User
    Join Date
    12-05-2007
    Posts
    1

    Searching for a value with a do loop

    could anybody help me write a macro that does the following..

    a. Write a sub-routine that asks for a product code using an input box. This should be placed inside a Do loop that checks whether the code is one on the list, the list has a range from a4-a124. It should then ask for the number of units purchased, which must be a positive number. (You may select an integer as the data type – however, it is safe to assume that the user will not enter a number like 3.84.) It should display a message something like the following: “You purchased at least ________________ units, you got a discount of _________________ on each unit.” Of course your code will fill in the blanks. The last sentence will not be displayed if the user didn’t purchase enough units to get a discount.
    b. Now write a sub-routine that first asks the user for the number of different products purchased. Then use a For loop that goes from 1 to this number, and place the code from the previous exercise modified if necessary inside the loop. That is, each time through the loop you should get the display information about a particular product purchased. At the end of the sub, display a message that shows the total amount spent on all purchases.
    c. Finally, write a sub-routine that asks the user for a purchase quantity that can be any multiple of 5 units, up to 50 units. Then enter a label in cell E3 entitled Cost of _______ units”, where the blank is filled in by the user’s input. Below this, enter the total cost of this many units for each product. For example, cell E4 will contain the purchase cost of this many units (the amount the user enters) of the first product in the list. Enter these as values, not formulas.

  2. #2
    Forum Contributor
    Join Date
    03-03-2005
    Posts
    316
    Roll,

    It seems you are asking for too much in one post. If you need assistance, it is best to keep your request simple. One or two issues at a time!

  3. #3
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689
    This sounds a lot like a homework assignment ...

    If it is, you'll get extra credit when you explain to your teacher that a Find is much faster than a Do loop.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1