Preview

Tutorial Cycle for VBA

Good Essays
Open Document
Open Document
1326 Words
Grammar
Grammar
Plagiarism
Plagiarism
Writing
Writing
Score
Score
Tutorial Cycle for VBA
Tutorial: CycleFor in VBA
Objective:
The objective of this document is to understand the use of the cycle For.in VBA there are three types of cycles:
For Next
Do While
Do Until
What is a cycle
Doing the exact same thing several times

For example, if I have 3 dirty plates, what would be my washing procedure?
Option 1
Take dirty plate 1
Scrub dirty plate 1
Rinse dirty plate 1
Dry dirty plate 1
Take dirty plate 2
Scrub dirty plate 2
Rinse dirty plate 2
Dry dirty plate 2
Take dirty plate 3
Scrub dirty plate 3
Rinse dirty plate 3
Dry dirty plate 3

Now imagine it being 50 plates.
What does the process mentioned before have in common? What do you observe is repeated? Let’s put a color to what is repeated.

Take dirty plate 1
Scrub dirty plate 1
Rinse dirty plate 1
Dry dirty plate 1
Take dirty plate 2
Scrub dirty plate 2
Rinse dirty plate 2
Dry dirty plate 2
Take dirty plate 3
Scrub dirty plate 3
Rinse dirty plate 3
Dry dirty plate 3

You can observe there are three cycles, this means the same steps are repeated three times, the only thing that changes is the plate number.
There is a representation for the cycle in code:
From plate=1 until 3 Take dirty plate
Scrub dirty plate
Rinse dirty plate
Dry dirty plate
Next plate

Summary
1) Before you program, generate your solution for the problem, like the cycle for dish washing, each instruction written independently. You don’t have to identify the pattern right away.
2) When you have your solution, identify the pattern that is repeated, you might have to adjust the instructions sometimes so that they are similar or depend on a variable.
3) Generate the pseudocode of the cycle.
4) Get ready to program.
Example of obtaining a cycle
You have been asked to generate a code to calculate the total funds that have been raised at a charity event.
You have to ask how many people have donated money, how much each one donated and give the final result.
TRY IT!!

You May Also Find These Documents Helpful

  • Satisfactory Essays

    Over $4.8 million has been donated and more than 184,000 volunteer hours have been worked (which…

    • 207 Words
    • 1 Page
    Satisfactory Essays
  • Satisfactory Essays

    This activity will assist you in the understanding of how output should appear after statements are executed (results) and how to write proper pseudocode.…

    • 393 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    IT/210 Appendix D

    • 453 Words
    • 4 Pages

    Up to this point, you have identified the processes the program must perform, but you have not given any consideration to exactly how the processes work together to solve the problem. At this point, you must generate a description of the processing using pseudocode, a natural language description of the processing the application must perform.…

    • 453 Words
    • 4 Pages
    Powerful Essays
  • Good Essays

    Total Discretionary Cash Flow = $50 + $70 + $60 + $20 + $15 = $215…

    • 620 Words
    • 3 Pages
    Good Essays
  • Satisfactory Essays

    Nap Bdhsfashjdj

    • 320 Words
    • 2 Pages

    A total of d dollars was donated to 4 charities. Each charity received $375. Which equation can be solved to find the total amount of money donated?…

    • 320 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Hca 311

    • 318 Words
    • 2 Pages

    The Mental Health program for the Community Center has just completed its fiscal year end. The program director determines that his program has revenue for the year of $1,210,000. He believes his variable expense amounts to $205,000 and he knows his fixed expense amounts to $1,100,000.…

    • 318 Words
    • 2 Pages
    Good Essays
  • Satisfactory Essays

    ($142,000 + $18,000 + $75,000 +$465,935.76 - $368,000 - $161,000 - $166,667 - 46,000 - 100,000)…

    • 446 Words
    • 2 Pages
    Satisfactory Essays
  • Powerful Essays

    EAS230Syllabus

    • 1748 Words
    • 8 Pages

    An introduction to computer programming with an emphasis on problem solving will be presented. Specific topics include:…

    • 1748 Words
    • 8 Pages
    Powerful Essays
  • Satisfactory Essays

    Financial Ratios

    • 273 Words
    • 2 Pages

    Fund Raising and expense ratio- Total fund raising expenses divided by total expenses. The total find raising expenses equals $117,903.00 and the total expenses equal $1,185,008.00. The fund raising and expense ratio equals 0.1…

    • 273 Words
    • 2 Pages
    Satisfactory Essays
  • Good Essays

    Analogy Baking a Cake

    • 457 Words
    • 2 Pages

    Step 3: mix the flour, baking powder and sugar together. The Analogy for sugar is the electron coming to photosystem II.…

    • 457 Words
    • 2 Pages
    Good Essays
  • Good Essays

    Growth Of Rats POW

    • 719 Words
    • 4 Pages

    Process: The first step that I took when solving this problem was to highlight all the…

    • 719 Words
    • 4 Pages
    Good Essays
  • Satisfactory Essays

    Conservation of Mass

    • 407 Words
    • 2 Pages

    Explain why the results for Part 2 were different from those for Part 1. What is the system used in Part 1? What is the system in Part 2? How do they differ?…

    • 407 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    |1. Understand the expected pattern of |1.1. Explain the sequence and rate of each | | |…

    • 489 Words
    • 2 Pages
    Satisfactory Essays
  • Satisfactory Essays

    Acct Problem B

    • 1174 Words
    • 5 Pages

    | +$15,000+ 15,000+ –600+ 14,400+ –3,000+ 11,400+000,000+ 11,400+ –800+ 10,600– +3,000+ 13,600+ –500+ 13,100+ –500+ 12,600+ –2,500+ 10,100– +4,000+$14,100…

    • 1174 Words
    • 5 Pages
    Satisfactory Essays
  • Powerful Essays

    DOT Pipeline Corrosion

    • 1600 Words
    • 16 Pages

    Corrosion Control and Monitoring ABC Company ABC Chemical Complex Engineering Specification ABC Chemical Complex 1 Corrosion Control & Monitoring  SCOPE – This Engineering Specification includes external and internal corrosion control and monitoring for DOT regulated pipelines. – Design, construction, construction inspection, construction acceptance, operation, and maintenance of DOT regulated pipelines are covered by this Engineering Specification. ABC Chemical Complex 2 Corrosion Control &Monitoring  GENERAL – All DOT regulated ABC pipelines require protection from the environment. – Corrosive elements in the pipeline stream must be neutralized or the pipe material must be resistant to the stream.…

    • 1600 Words
    • 16 Pages
    Powerful Essays