Practice Problems Flowcharting and VBA Code

Directions: When solving the following problems start with a blank piece of paper, read the problem, think about the steps needed then start drawing the flowchart symbols on the paper in the correct order. Use the sample flowchart symbols by using the link listed below, perhaps printing them out and having them in front of you as you work would be helpful. When done, click on the Flowchart solution link to see how well that you have done, if your work does not match the solution, start over again with another blank sheet of paper, keep practicing until you get it right. I say in class learning programming is like learning to play the piano, you need to practice a lot. I remember when I was first learning I could not play some songs fast enough from reading the music because I had to keep looking at the positions of my fingers, some songs I had to memorize to get up to speed, you need to memorize the shapes and meanings of the flowchart symbols in the same way through practice. Some students have said that learning programming is like taking a foreign language, they are right, I remember taking French in college and practicing in the language lab for hours on pronouncing the sentences correctly. To learn the correct syntax of the VBA statements takes a lot of practice. Once you get the flowchart correct follow the same plan for the program, start with a blank sheet of paper, look at the finished flowchart and write a VBA statement for each flowchart symbol. When done click on the VBA Solution Code link to see how well you did, again if your work did not match the solution try again on a blank sheet until you get it right. There are no short-cuts to learn programming, it takes practice, practice, practice, you get out of something the amount of work that you put into it, good-luck enjoy the journey.

VBA Coding Tips:
Remember most every program has four main sections:
1) Declaring Variables
2) Getting Inputs
3) Processing steps (Calculations)
4) Outputs
This will help you put your program statements in the right order. You might want to put these four steps in your program code as comment statements to keep you on the right path.

When typing in your code look at what the computer is telling you on the screen. Once you type in a function name like InputBox it displays the arguments in the correct order, please use it. Another example when you use  an object like a command button (cmdCalculate); when you type in the period at the end of the object name you get a pull-down list of properties and methods, type in a few unique letter for the property or method and it will move to that value in the list, just hit the Tab key to accept it. This not only saves a lot of typing but also a lot of errors. This is called the intellisense feature of VBA, please make use of it.

Really try to understand the code as you are entering it, do not just type it in blindly. If you are having trouble understanding a VBA statement like Rnd, select it, then press the F1 function key, this will take you to Microsoft's site and give you help for the statement. If you are lucky there may even be some example code listed for the statement, there has been many a time when I copied this sample code into my program and then revised it for my particular situation.

Flowcharting Symbols

Practice Problem Examples

Excel Chapter 3

Excel Chapter 4