Excel® VBA for physicists : a primer

Physics
IOP Publishing
2016
EISBN 9781681744612
Preface.
1. Introduction.
1.1. Preparation.
1.2. Demonstrating a simple function.
1.3. Saving a macro-enabled workbook.
1.4. Using constants and VB functions.
1.5. User-defined array function.
1.6. Notes on VBA functions.
1.7. A simple subroutine.
1.8. Linking an image to a subroutine.
1.9. Recording a macro.
1.10. Finding a home for macros.
1.11. Typographical matters
2. Variables, Dim statements, and data types.
2.1. Naming variables.
2.2. The Dim statement.
2.3. The major reason for variable declarations.
2.4. Declarations in function headers and for constants.
2.5. Data types.
2.6. A second reason for variable declarations.
2.7. Dimensioning arrays.
2.8. The Set statement.
2.9. The With ... End With structure
3. Structured programming.
3.1. Branching structures (If and Select Case).
3.2. Looping structures (For ... Next and Do ... While/Until).
3.3. Some further examples
4. The Excel object model.
4.1. Examples of properties, methods and events.
4.2. The Range object properties.
4.3. Range object methods.
4.4. WorksheetFunction object.
4.5. Workbook and worksheet events.
4.6. Code for sending email
5. Working with add-ins.
5.1. Creating an add-in.
5.2. Installation.
5.3. Using the add-in.
5.4. Making changes to the add-in.
5.5. Viewing worksheets.
5.6. Protecting the add-in.
5.7. Reversing everything
6. Numerical integration.
6.1. The trapezoid approximation.
6.2. The Simpson 1/3 approximation.
6.3. An aside.
6.4. Monte Carlo integration.
6.5. Gaussian and Romberg integration
7. Numerical methods for differential equations.
7.1. Euler's method.
7.2. The Runge-Kutta fourth-order method.
7.3. Simultaneous OEDs.
7.4. Example of a system of two OEDs.
7.5. Higher order OEDs.
7.6. R-L circuit
8. Finding roots.
8.1. The bisection method.
8.2. The successive iteration method.
8.3. Root finding with Solver.
8.4. Using range names.
This book is both an introduction and a demonstration of how Visual Basic for Applications (VBA) can greatly enhance Microsoft Excel® by giving users the ability to create their own functions within a worksheet and to create subroutines to perform repetitive actions. The book is written so readers are encouraged to experiment with VBA programming with examples using fairly simple physics or non-complicated mathematics such as root finding and numerical integration. Tested Excel® workbooks are available for each chapter and there is nothing to buy or install.
1. Introduction.
1.1. Preparation.
1.2. Demonstrating a simple function.
1.3. Saving a macro-enabled workbook.
1.4. Using constants and VB functions.
1.5. User-defined array function.
1.6. Notes on VBA functions.
1.7. A simple subroutine.
1.8. Linking an image to a subroutine.
1.9. Recording a macro.
1.10. Finding a home for macros.
1.11. Typographical matters
2. Variables, Dim statements, and data types.
2.1. Naming variables.
2.2. The Dim statement.
2.3. The major reason for variable declarations.
2.4. Declarations in function headers and for constants.
2.5. Data types.
2.6. A second reason for variable declarations.
2.7. Dimensioning arrays.
2.8. The Set statement.
2.9. The With ... End With structure
3. Structured programming.
3.1. Branching structures (If and Select Case).
3.2. Looping structures (For ... Next and Do ... While/Until).
3.3. Some further examples
4. The Excel object model.
4.1. Examples of properties, methods and events.
4.2. The Range object properties.
4.3. Range object methods.
4.4. WorksheetFunction object.
4.5. Workbook and worksheet events.
4.6. Code for sending email
5. Working with add-ins.
5.1. Creating an add-in.
5.2. Installation.
5.3. Using the add-in.
5.4. Making changes to the add-in.
5.5. Viewing worksheets.
5.6. Protecting the add-in.
5.7. Reversing everything
6. Numerical integration.
6.1. The trapezoid approximation.
6.2. The Simpson 1/3 approximation.
6.3. An aside.
6.4. Monte Carlo integration.
6.5. Gaussian and Romberg integration
7. Numerical methods for differential equations.
7.1. Euler's method.
7.2. The Runge-Kutta fourth-order method.
7.3. Simultaneous OEDs.
7.4. Example of a system of two OEDs.
7.5. Higher order OEDs.
7.6. R-L circuit
8. Finding roots.
8.1. The bisection method.
8.2. The successive iteration method.
8.3. Root finding with Solver.
8.4. Using range names.
This book is both an introduction and a demonstration of how Visual Basic for Applications (VBA) can greatly enhance Microsoft Excel® by giving users the ability to create their own functions within a worksheet and to create subroutines to perform repetitive actions. The book is written so readers are encouraged to experiment with VBA programming with examples using fairly simple physics or non-complicated mathematics such as root finding and numerical integration. Tested Excel® workbooks are available for each chapter and there is nothing to buy or install.
