Page 10 - Excel for Scientists and Engineers: Numerical Methods
P. 10

Contents



               Preface  ...........: ....................................................................................................  xv
               Acknowledgments ...............................................................................................   xix
               About the Author .................................................................................................  xix

               Chapter 1  Introducing Visual Basic for Applications                   1
               The Visual Basic Editor .........................................................................................   1
               Visual Basic Procedures .........................................................................................   4
                   There Are Two Kinds of Macros .....................................................................  4
                   The Structure of a Sub Procedure ....................................................................   4
                   The Structure of a Function Procedure ............................................................   5
                   Using the Recorder to Create a Sub Procedure ............................................  5
                   The Personal Macro Workbook .......................................................................  7
                   Running a Sub Procedure ................................................................................   8
                   Assigning a Shortcut Key to a Sub Procedure .................................................  8
               Entering VBA Code ...............................................................................................  9
                   Creating a Simple Custom Function ..............................................................   10
                   Using a Function Macro ................................................................................  10
                   A Shortcut to Enter a Function ......................................................................   12
                Some FAQs ..........................................................................................................  13
                Chapter 2  Fundamentals of Programming with VBA                      15
                Components of Visual Basic Statements ..............................................................   15
                   Operators  ........................................................................................................   16
                   Variables ........................................................................................................  16
                   Objects, Properties, and Methods ..................................................................  17
                   Objects ...........................................................................................................   17
                   Properties .......................................................................................................   17
                   Using Properties  .............................................................................................   19
                   Functions  ........................................................................................................   20
                   Using Worksheet Functions with VBA .........................................................  22
                   Some Useful Methods  ....................................................................................   22
                   Other Keywords .............................................................................................   23
                Program Control ...................................................................................................   23
                   Branching .......................................................................................................   23
                   Logical Operators ..........................................................................................   24
                   Select Case  .....................................................................................................   24
                   Looping ..........................................................................................................   24
                   For ... Next Loop ..............................................................................................  25
                   Do While ... Loop  ...........................................................................................   25




                                                  vii
   5   6   7   8   9   10   11   12   13   14   15