You are previewing Excel® Programming: Your visual blueprint™ for creating interactive spreadsheets.
O'Reilly logo
Excel® Programming: Your visual blueprint™ for creating interactive spreadsheets

Book Description

A great guide to Excel programming that is perfect for visual learners and takes you beyond Excel basics!

This book is the perfect reference for Excel users who want to delve deeper into the application to create powerful and dynamic programs. From creating macros to customizing dialog boxes, this step-by-step guide helps you get more out of Excel than you knew was possible. Each step has callouts so you can see exactly where the action takes place and this Web site offers tons of usable code and sample macros that you can put to use instantly.

  • Explains step-by-step how to automate Excel, the world's leading spreadsheet application from Microsoft

  • Covers most tasks in two-page spreads -- no flipping back and forth required!

  • Teaches you over 130 tasks, including how to record macros, program in Visual Basic for Applications (VBA), debug code, automate charts, interface with other macros, automate functions -- all in an easy-to-follow visual format

  • Uses clear, step-by-step, numbered instruction and lots of graphics and screenshots -- perfect for visual learners!

  • Helps you maximize your productivity with practical examples, tips, and advice

Harness everything that Excel has to offer with this friendly, practical, visual guide.

Table of Contents

  1. Copyright
  2. Credits
  3. About the Author
  4. Author's Acknowledgments
  5. How to Use This Visual Blueprint Book
    1. Who This Book Is For
    2. The Conventions in This Book
  6. 1. Using Macros and Form Controls
    1. 1.1. Introducing Excel Programming
    2. 1.2. Introducing Macros
    3. 1.3. Set Macro Security
    4. 1.4. Create a Digital Signature
    5. 1.5. Record a Macro
    6. 1.6. Assign a Digital Signature to a Macro
    7. 1.7. Run a Macro
    8. 1.8. Create and Launch a Keyboard Shortcut
    9. 1.9. Assign a Macro to the Quick Access Toolbar
    10. 1.10. Delete a Macro
    11. 1.11. Add a Form Control to a Worksheet
    12. 1.12. Assign Values to a Form Control
    13. 1.13. Add a Macro to a Form Control
  7. 2. Using the Visual Basic Editor
    1. 2.1. Introducing the Visual Basic Editor
    2. 2.2. Activate the Visual Basic Editor
    3. 2.3. Open Visual Basic Editor Windows
    4. 2.4. Set Properties for a Project
    5. 2.5. Set Display Options for the Code Window
    6. 2.6. Add a New Module
    7. 2.7. Remove a Module
    8. 2.8. Hide a Macro
    9. 2.9. Update a Macro
  8. 3. Introducing Visual Basic for Applications
    1. 3.1. Create Sub Procedures
    2. 3.2. Create Functions
    3. 3.3. Comment Your Code
    4. 3.4. Reference Cells and Ranges
    5. 3.5. Understanding Variables and Data Types
    6. 3.6. Declare Variables
    7. 3.7. Work with Strings
    8. 3.8. Work with Numbers
    9. 3.9. Create a Constant
  9. 4. Introducing the Excel Object Model
    1. 4.1. Discover the Excel Object Model
    2. 4.2. Access the Excel Object Model Reference
    3. 4.3. Create an Object Variable
    4. 4.4. Change the Properties of an Object
    5. 4.5. Compare Object Variables
    6. 4.6. Using an Object Method
    7. 4.7. Display a Built-in Dialog Box
  10. 5. Understanding Arrays
    1. 5.1. Declare an Array
    2. 5.2. Declare a Multidimensional Array
    3. 5.3. Convert a List to an Array
    4. 5.4. Redimension an Array
    5. 5.5. Create a User-Defined Data Type
  11. 6. Controlling Program Flow
    1. 6.1. Create Comparisons
    2. 6.2. Make Use of Logical Operators
    3. 6.3. Employ Do While Loops
    4. 6.4. Create Do Until Loops
    5. 6.5. Create For Next Loops
    6. 6.6. Execute For Each In Loops
    7. 6.7. Create If Then Else Statements
    8. 6.8. Construct Select Case Statements
    9. 6.9. GoTo a Named Location
    10. 6.10. Call a Procedure
  12. 7. Using Excel Worksheet Functions
    1. 7.1. Work with Excel Worksheet Functions
    2. 7.2. Work with a MsgBox Function
    3. 7.3. Using the InputBox Function
    4. 7.4. Retrieve the Current Date and Time
    5. 7.5. Perform Date and Time Calculations
    6. 7.6. Format a Date Expression
    7. 7.7. Format a Numeric Expression
    8. 7.8. Change the Case of a String
    9. 7.9. Return a Portion of a String
  13. 8. Debugging Macros
    1. 8.1. Debug a Procedure with Inserted Breakpoints
    2. 8.2. Using the Watches Window to Debug a Procedure
    3. 8.3. Step through a Procedure
    4. 8.4. Using the Immediate Window
    5. 8.5. Resume Execution When an Error Is Encountered
    6. 8.6. Process a Runtime Error
  14. 9. Working with Workbooks and Files
    1. 9.1. Open a Workbook
    2. 9.2. Open a Text File as a Workbook
    3. 9.3. Open a File Requested by the User
    4. 9.4. Save a Workbook
    5. 9.5. Save a Workbook in a Format Specified by the User
    6. 9.6. Determine if a Workbook Is Open
    7. 9.7. Close a Workbook
    8. 9.8. Create a New Workbook
    9. 9.9. Delete a File
  15. 10. Working with Worksheets
    1. 10.1. Add a Sheet
    2. 10.2. Delete a Sheet
    3. 10.3. Move a Sheet
    4. 10.4. Copy a Sheet
    5. 10.5. Hide a Sheet
    6. 10.6. Change the Name of a Sheet
    7. 10.7. Save a Sheet to Another File
    8. 10.8. Protect a Worksheet
    9. 10.9. Protect a Chart
    10. 10.10. Print a Sheet
    11. 10.11. Sort Sheets by Name
  16. 11. Defining Ranges
    1. 11.1. Using the Range Property
    2. 11.2. Using the Cells Property
    3. 11.3. Combine Multiple Ranges
    4. 11.4. Using the Offset Property
    5. 11.5. Delete a Range of Cells
    6. 11.6. Hide a Range of Cells
    7. 11.7. Create a Range Name
    8. 11.8. Resize a Range
    9. 11.9. Insert a Range
    10. 11.10. Set the Width of Columns in a Range
    11. 11.11. Set the Height of Rows in a Range
  17. 12. Working with Cells
    1. 12.1. Cut and Paste Ranges of Cells
    2. 12.2. Copy and Paste Ranges of Cells
    3. 12.3. Using Paste Special Options When Pasting
    4. 12.4. Add Comments to a Cell
    5. 12.5. Automatically Fill a Range of Cells
    6. 12.6. Copy a Range to Multiple Sheets
    7. 12.7. Add a Border
    8. 12.8. Find Specific Cell Values
    9. 12.9. Find and Replace Values in Cells
  18. 13. Working with Lists
    1. 13.1. Convert a Column of Text into Multiple Columns
    2. 13.2. Perform a Sort
    3. 13.3. Perform a Filter
    4. 13.4. Perform an Advanced Filter
    5. 13.5. Create Subtotals
    6. 13.6. Create Groups
    7. 13.7. Define a List as a Table
  19. 14. Creating Dialog Boxes and Customizing the Ribbon
    1. 14.1. UserForm Basics
    2. 14.2. Create a Custom Dialog Box
    3. 14.3. Call a Custom Dialog Box from a Procedure
    4. 14.4. Capture Input from a Custom Dialog Box
    5. 14.5. Validate Input from a Dialog Box
    6. 14.6. Create Custom UserForm Controls
    7. 14.7. Create a UserForm Template
    8. 14.8. Customize the Ribbon
    9. 14.9. Create a CustomUI.xml File
    10. 14.10. Add a CustomUI.xml File to a Workbook
    11. 14.11. Add Additional Options to the Ribbon
  20. 15. Working with Charts
    1. 15.1. Create a Chart Sheet
    2. 15.2. Embed a Chart in a Worksheet
    3. 15.3. Apply Chart Wizard Settings to a Chart
    4. 15.4. Add a New Data Series to a Chart
    5. 15.5. Format Chart Text
    6. 15.6. Create Charts with Multiple Chart Types
    7. 15.7. Add a Data Table to a Chart
  21. 16. Working with PivotTables
    1. 16.1. Create a PivotTable
    2. 16.2. Add Fields to a PivotTable
    3. 16.3. Display Subtotals and Grand Totals
    4. 16.4. Filter a PivotTable
    5. 16.5. Create Groups
  22. 17. Automating Procedures with Excel Events
    1. 17.1. Understanding Excel Events
    2. 17.2. Run a Procedure as a Workbook Opens
    3. 17.3. Run a Procedure before Closing a Workbook
    4. 17.4. Run a Procedure before Saving a Workbook
    5. 17.5. Run a Procedure When Excel Creates a Workbook
    6. 17.6. Execute a Procedure at a Specific Time
    7. 17.7. Execute a Procedure When You Press Keys
    8. 17.8. Monitor a Range of Cells for Changes
  23. 18. Building Add-Ins
    1. 18.1. Create an Add-In
    2. 18.2. Set Add-In Properties
    3. 18.3. Install Add-Ins
    4. 18.4. Using VBA to Load Add-Ins
  24. 19. Understanding XML
    1. 19.1. Introducing XML
    2. 19.2. Understanding Excel XML Files
    3. 19.3. Open an XML File in Excel as a Table
    4. 19.4. Create an XML Map
    5. 19.5. Import and Export XML Files Using Excel
    6. 19.6. Load XML Files Using VBA
    7. 19.7. Import XML Files Using VBA
  25. A. VBA Quick Reference
    1. A.1. VBA and Excel Object Model Quick Reference