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

Similar book on Amazon
Excel 2003 Power Programming with VBA (Book & CD-ROM)
Excel 2003 Power Programming with VBA (Book & CD-ROM)
Microsoftu00ae Office Excelu00ae 2007 Visual Basicu00ae for Applications Step by Step (BPG-step by Step)
Microsoftu00ae Office Excelu00ae 2007 Visual Basicu00ae for Applications Step by Step (BPG-step by Step)
Excel 2003 Formulas
Excel 2003 Formulas
Writing Excel Macros with VBA, 2nd Edition
Writing Excel Macros with VBA, 2nd Edition

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