loop?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • metric6
    New Member
    • Mar 2008
    • 1

    loop?

    I need to write a macro so that if a sales person from our company selects a given quantity of a specific item it will prompt a question that has a yes or no asnwer. if yes then it will need to add quantities for other items. for example, if they put qty = 1 for item "ZZ" , it will ask if they would like "q" and "x" as well, if yes it should put qty "1" next to those items in the sheet. I have never made macros and need help badly.
  • kadghar
    Recognized Expert Top Contributor
    • Apr 2007
    • 1302

    #2
    Originally posted by metric6
    I need to write a macro so that if a sales person from our company selects a given quantity of a specific item it will prompt a question that has a yes or no asnwer. if yes then it will need to add quantities for other items. for example, if they put qty = 1 for item "ZZ" , it will ask if they would like "q" and "x" as well, if yes it should put qty "1" next to those items in the sheet. I have never made macros and need help badly.
    To do the loop, something like this will do
    [CODE=vb]
    Do
    if msgbox ("do you want to...¿?", vbyesno) = vbno then exit do
    'the code for adding things
    loop[/CODE]

    The code for adding things would require for you to read some tutorials about VBA (visual basic for applications). Put special attention in the objects: CELLS RANGE WORKSHEETS WORKBOOKS and its properties, such as VALUE.

    If you have then some specific doubts, we'll be glad to help you.

    Comment

    Working...