Test One Study Guide - Fall 2007


  1. The doPause() Sub, Timer, currentTime, stopTime, For Next loop and Do While loop comparison. Sent as email at about 59252 on Friday afternoon.
    ?Timer
     59252.75 
    ?Timer / (60 * 60)
     16.46401 
    ?Time
    4:27:58 PM 
    ?Date
    10/12/2007 
    


  2. Sample question: Write and place the doPause() Sub could be an exam question. You need to be able to write doPause() with or without a parameter. You need to be able to place it where it would cause the DELAY or PAUSE that is desired.
    What does Timer do?  Hint:  Try View menu, Immediate and type 
    
              ?Timer   (Also try this one:   ?Timer / 3600    and
                                             ?Timer / (60 * 60)
                                                           to see the result).
    How do you write a Do While loop?
    Do While condition                   What is the condition? <  <=
       loop body (VBA statements)                               >  >=
    Loop                                                        =  <>
    
    What time is it Timer + 300 if right now ?Timer / 3600 gives 12.0 when
                                                           you press enter?
                    (View menu, Immediate window in VBA).
                     -          -
    
    What does the actor (variable) stopTime do in the pause or doPause()?
    List all of the lines of code that stopTime will occur in.
    
    What does the actor (VBA variable) currentTime do?  What role does it
    play in the Sub doPause()?  What statements or lines of code does
    it play a part in?
    
    What does DoEvents do?
    
    What things have to be done BEFORE the Do While condition line?
    
    What things (statements) have to be done WITHIN the loop body?
    
    1.     BEFORE loop gets started statements
    2.     Do While some logical condition
    
    3.        loop body statement (actions)
    
    4.     Loop
    
    If you study these questions with pen in hand, and also try them at
    the computer, you will get 100% on the question that requires you
    to write and to use a pause() or a doPause() Sub.
    
    What is the difference between Sub pauseHalfSecond()
    
                               and Sub doPause(pauseAmount As Single)
    
    Write the code for BOTH of these.  Which one has 0.5 inside it,
    and which one has pauseAmount inside it?
    
       0.5 is a literal, and pauseAmount is a variable.
       ---                   -----------
    

  3. Racing Rectangles should be studied carefully. Good example of Do While ... Loop with a For Each ... Next rectangle loop nested within it.
  4. Coloring Repeat birthday's YELLOW and the new CELLS( whatRow, whatColumn ) powerful and easy to use command. Illustrates a For Next loop with For r = 3 to 24. Very nice.
  5. The Showing of Duplicate Birthdays as YELLOW and the showing the MM/DD date of a duplicated birthday in column B. For example, show that 33 is Feb 2 or 02/02 in the column B cell. What is ColorIndex xlNone? What is theCell.Offset(0, 1).Value used for? What is theCell.Offset(-1, 0) used for?
  6. STUDY THIS: VBA Macros - variations on 23 birthdays probability problem.
  7. The Offset Technique with Excel VBA. Study this in connection with the 2nd to last slide of the Excel birthday problem PowerPoint published slide show above.
  8. Show Duplicates and updateTotalsOnWorksheet Sub with an ARGUMENT aka PARAMETER passed to the Sub. The argument is a Boolean variable, which means TRUE and FALSE are the values it can store.
  9. Sample question involving For Each loop:
    Write the macro that takes the cells in columns A and B and rows 2 
    through 40 and does the following:
    
       1. counts how many of the cells contain numbers that are 
          100 or larger, and 
    
       2.  puts the count into the cell with address F2 on the same
           worksheet.
    
    Note:  I would show you an example screen snapshot of the spreadsheet
           on the blackboard or on the exam or on the Elmo projector.
    
    What do you have to know to do this?  For Each loops
                                          n = 0     initializing a counter
                                                         to zero ( 0 )
                                          n = n + 1 counting with a counter, 
                                                         i.e. adding 1 to
                                                         the counter n.
    
                                          If condition Then
                                             do whatever you want to do
                                             when condition is TRUE
                                          End If
    
                  Range("F2").Value = n   How to specify the cell on a
                                          worksheet and its .Value
                                          property so you can place
                                          a number or string there.
    
                  Range("U2").Value = "Happy Homecoming UNI Panthers!"
    
                  >= relational operator as in theCell.Value >= 100
                                               --------------------
                                               a Boolean condition
                                               that is True or False
    

  10. Do you have lots of other sample and practice questions on the handout you got last month and got again last Friday? Yes! Monday, October 02, 2006 old exam.