Key Points


  • Use an If structure to make a decision. Add an Else clause if you need different actions for True and False conditions.

  • When you use a MsgBox, use the Buttons argument to create explicit choices. When checking the result of a MsgBox, be sure to test against the proper constant.

  • When you use an InputBox, be sure to think through all the possible types of input-valid, invalid, non-existent. Create an If structure to handle all the possible conditions.

  • When you simply need to loop through a collection, a For Each is the easiest option.

  • When you need a counter to help you as you work through a loop-for example, to keep two objects synchronized-use a For loop.

  • When you need to loop for a while or until a condition is True, use a Do loop A Do loop is extremely flexible, but be careful that you don’t create an infinite loop.

  • Use permanent and temporary breakpoints when troubleshooting large macros or loops.



Microsoft Office Excel 2007 Visual Basic for Applications Step by Step
Microsoft Excel 2002 Visual Basic for Applications Step by Step (Step by Step (Microsoft))
ISBN: 0735613591
EAN: 2147483647
Year: 2004
Pages: 99
Authors: Reed Jacobsen

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net