Writing Excel Macros with VBA [2nd ed] 9780596516963, 0596516967, 9780596555238, 0596555237

Newly updated for Excel 2002, Writing Excel Macros with VBA, 2nd Edition provides Excel power-users, as well as programm

581 54 3MB

English Pages 560 Year 2007

Report DMCA / Copyright

DOWNLOAD FILE

Writing Excel Macros with VBA [2nd ed]
 9780596516963, 0596516967, 9780596555238, 0596555237

Table of contents :
Content: Table of Contents
Preface
Preface to the Second Edition
The Book's Audience
Organization of This Book
The Book's Text and Sample Code
About the Code
Conventions in this Book
Obtaining the Sample Programs
How to Contact Us
Acknowledgments
Introduction
Selecting Special Cells
Setting a Chart's Data Point Labels
Topics in Learning Excel Programming
Part I
Preliminaries
What Is a Programming Language?
Programming Style
Comments
Readability
Modularity
The Visual Basic Editor, Part I
The Project Window
Project Names
Project Contents
The ThisWorkbook object
Sheet objects. Standard modulesClass modules
UserForm objects
The Properties Window
The Code Window
Procedure and Full-Module Views
The Object and Procedure List Boxes
A workbook or sheet object
A standard module
A UserForm object
The Immediate Window
Arranging Windows
Docking
The Visual Basic Editor, Part II
Navigating the IDE
General Navigation
Navigating the code window at design time
Tracing code
Bookmarks
Getting Help
Creating a Procedure
Run Time, Design Time, and Break Mode
Errors
Design-Time Errors
Compile-Time Errors
Run-Time Errors
Logical Errors
Debugging
Tracing. Stepping intoStep Over (Shift-F8 or choose Step Over from the Debug menu)
Step Out (Ctrl-Shift-F8 or choose Step Out from the Debug menu)
Run To Cursor (Ctrl-F8 or choose Run To Cursor from the Debug menu)
Set Next Statement (Ctrl-F9 or choose Set Next Statement from the Debug menu)
Breaking out of Debug mode
Watching Expressions
Quick Watch (Shift-F9)
The Locals and Watches windows
Macros
Recording Macros
Running Macros
Part II
Variables, Data Types, and Constants
Comments
Line Continuation
Constants
Enums
Variables and Data Types
Variable Declaration. The Importance of Explicit Variable DeclarationOption Explicit
Numeric Data Types
Boolean Data Type
String Data Type
Date Data Type
Variant Data Type
Excel Object Data Types
The generic As Object declaration
The Set statement
Arrays
The dimension of an array
Dynamic arrays
The UBound function
Variable Naming Conventions
Variable Scope
Procedure-level (local) variables
Module-level variables
Variable Lifetime
Static variables
Variable Initialization
VBA Operators
Functions and Subroutines
Calling Functions
Calling Subroutines
Parameters and Arguments
Optional Arguments. Named ArgumentsByRef Versus ByVal Parameters
Exiting a Procedure
Public and Private Procedures
Project References
Fully Qualified Procedure Names
Built-in Functions and Statements
The MsgBox Function
The InputBox Function
VBA String Functions
Miscellaneous Functions and Statements
The Is Functions
The IsDate function
The IsEmpty function
The IsNull function
The IsNumeric function
The Immediate If Function
The Switch Function
Units Conversions
The Beep Statement
Handling Errors in Code
The On Error Goto Label Statement
The Error Object
The On Error GoTo 0 Statement.

Polecaj historie