Skip to main content



Excel 2007 VBA Programming For Dummies

John Walkenbach, Jan Karel Pieterse (Revised by)

ISBN: 978-0-470-04674-6 February 2007 384 Pages


Step-by-step instructions for creating VBA macros

Harness the power of VBA and create custom Excel applications

Make Excel 2007 work for you! This clear, nonintimidating guide shows you how to use VBA to create Excel apps that look and work the way you want. Packed with plenty of sample programs, it explains how to work with range objects, control program flow, develop custom dialog boxes, create custom toolbars and menus, and much more.

Discover how to

  • Grasp essential programming concepts
  • Use the Visual Basic Editor
  • Navigate the new Excel user interface
  • Communicate with your users
  • Deal with errors and bugs

Introduction 1

Part I: Introducing VBA 9

Chapter 1: What Is VBA? 11

Chapter 2: Jumping Right In 21

Part II: How VBA Works with Excel 33

Chapter 3: Working In the Visual Basic Editor 35

Chapter 4: Introducing the Excel Object Model 53

Chapter 5: VBA Sub and Function Procedures 67

Chapter 6: Using the Excel Macro Recorder 79

Part III: Programming Concepts 91

Chapter 7: Essential VBA Language Elements 93

Chapter 8: Working with Range Objects 113

Chapter 9: Using VBA and Worksheet Functions 125

Chapter 10: Controlling Program Flow and Making Decisions 139

Chapter 11: Automatic Procedures and Events 157

Chapter 12: Error-Handling Techniques 177

Chapter 13: Bug Extermination Techniques 191

Chapter 14: VBA Programming Examples 203

Part IV: Communicating with Your Users 221

Chapter 15: Simple Dialog Boxes 223

Chapter 16: UserForm Basics 239

Chapter 17: Using UserForm Controls 255

Chapter 18: UserForm Techniques and Tricks 275

Chapter 19: Accessing Your Macros Through the User Interface 299

Part V: Putting It All Together 315

Chapter 20: Creating Worksheet Functions and Living to Tell about It 317

Chapter 21: Creating Excel Add-Ins 333

Part VI: The Part of Tens 345

Chapter 22: Ten VBA Questions (And Answers) 347

Chapter 23: (Almost) Ten Excel Resources 351

Index 355

Bonus Chapter 01: Interacting with Other Office Applications
Bonus Chapter 02: Ten VBA Do�s and Don�ts
Download a ZIP archive of the code