You are previewing Excel VBA Programming For Dummies.
O'Reilly logo
Excel VBA Programming For Dummies

Book Description

Take your data analysis and Excel programming skills to new heights

In order to take Excel to the next level, you need to understand and implement the power of Visual Basic for Applications (VBA). This 4th edition of Excel VBA Programming For Dummies introduces you to a wide array of new Excel options, beginning with the most important tools and operations for the Visual Basic Editor. Inside, you'll get the lowdown on the essential elements and concepts for programming with Excel, discover techniques for handling errors and exterminating bugs, working with range objects, controlling program flow, and much more.

With the release of Microsoft Office 2016, Excel will see changes in its operating system, and this fun, hands-on guide will make it easier than ever to harness the power of Visual Basic for Applications and create custom applications and macros on the world's most popular spreadsheet tool. Packed with friendly advice on the easiest ways to develop custom dialog boxes, toolbars, and menus, you'll be creating Excel applications custom-fit to your unique needs in no time at all!

  • Provides step-by-step instructions for creating VBA macros to maximize productivity
  • Helps to increase efficiency by demonstrating how to customize your applications so they look and work the way you want
  • Fully updated for Excel 2016
  • All sample programs, VBA code, and worksheets are available at dummies.com

If you're a beginning to intermediate VBA programmer looking to get up to speed on creating customized solutions with Excel applications, Excel VBA Programming For Dummies, 4th Edition makes it easier.

Table of Contents

    1. Cover
    2. Introduction
      1. About this Book
      2. Obligatory Typographical Conventions Section
      3. Check Your Security Settings
      4. Foolish Assumptions
      5. Icons Used in This Book
      6. Beyond the Book
      7. Where to Go from Here
    3. Part I: Getting Started with Excel VBA Programming
      1. Chapter 1: What Is VBA?
        1. Okay, So What Is VBA?
        2. What Can You Do with VBA?
        3. Advantages and Disadvantages of VBA
        4. VBA in a Nutshell
        5. An Excursion into Versions
      2. Chapter 2: Jumping Right In
        1. First Things First
        2. What You’ll Be Doing
        3. Taking the First Steps
        4. Recording the Macro
        5. Testing the Macro
        6. Examining the Macro
        7. Modifying the Macro
        8. Saving Workbooks That Contain Macros
        9. Understanding Macro Security
        10. Revealing More about the NameAndTime Macro
    4. Part II: How VBA Works with Excel
      1. Chapter 3: Working in the Visual Basic Editor
        1. What Is the Visual Basic Editor?
        2. Working with the Project Window
        3. Working with a Code Window
        4. Customizing the VBA Environment
      2. Chapter 4: Introducing the Excel Object Model
        1. Excel Is an Object?
        2. Climbing Down the Object Hierarchy
        3. Wrapping Your Mind around Collections
        4. Referring to Objects
        5. Diving into Object Properties and Methods
        6. Finding Out More
      3. Chapter 5: VBA Sub and Function Procedures
        1. Understanding Subs versus Functions
        2. Naming Subs and Functions
      4. Chapter 6: Using the Excel Macro Recorder
        1. Is It Live, or Is It VBA?
        2. Recording Basics
        3. Preparing to Record
        4. Relative or Absolute?
        5. What Gets Recorded?
        6. Recording Options
        7. Is This Thing Efficient?
    5. Part III: Programming Concepts
      1. Chapter 7: Essential VBA Language Elements
        1. Using Comments in Your VBA Code
        2. Using Variables, Constants, and Data Types
        3. Using Assignment Statements
        4. Working with Arrays
        5. Using Labels
      2. Chapter 8: Working with Range Objects
        1. A Quick Review
        2. Other Ways to Refer to a Range
        3. Some Useful Range Object Properties
        4. Some Useful Range Object Methods
      3. Chapter 9: Using VBA and Worksheet Functions
        1. What Is a Function?
        2. Using Built-In VBA Functions
        3. Using Worksheet Functions in VBA
        4. Using Custom Functions
      4. Chapter 10: Controlling Program Flow and Making Decisions
        1. Going with the Flow, Dude
        2. The GoTo Statement
        3. Decisions, Decisions
        4. Knocking Your Code for a Loop
        5. Using For Each-Next Loops with Collections
      5. Chapter 11: Automatic Procedures and Events
        1. Preparing for the Big Event
        2. Where Does the VBA Code Go?
        3. Writing an Event-Handler Procedure
        4. Introductory Examples
        5. Examples of Activation Events
        6. Other Worksheet-Related Events
        7. Events Not Associated with Objects
      6. Chapter 12: Error-Handling Techniques
        1. Types of Errors
        2. An Erroneous Example
        3. Handling Errors Another Way
        4. Handling Errors: The Details
        5. An Intentional Error
      7. Chapter 13: Bug Extermination Techniques
        1. Species of Bugs
        2. Identifying Bugs
        3. Debugging Techniques
        4. About the Debugger
        5. Bug Reduction Tips
      8. Chapter 14: VBA Programming Examples
        1. Working with Ranges
        2. Changing Excel Settings
        3. Working with Charts
        4. VBA Speed Tips
    6. Part IV: Communicating with Your Users
      1. Chapter 15: Simple Dialog Boxes
        1. UserForm Alternatives
        2. The MsgBox Function
        3. The InputBox Function
        4. The GetOpenFilename Method
        5. The GetSaveAsFilename Method
        6. Getting a Folder Name
        7. Displaying Excel’s Built-in Dialog Boxes
      2. Chapter 16: UserForm Basics
        1. Knowing When to Use a UserForm
        2. Creating UserForms: An Overview
        3. Working with UserForms
        4. A UserForm Example
      3. Chapter 17: Using UserForm Controls
        1. Getting Started with Dialog Box Controls
        2. Dialog Box Controls: The Details
        3. Working with Dialog Box Controls
        4. Dialog Box Aesthetics
      4. Chapter 18: UserForm Techniques and Tricks
        1. Using Dialog Boxes
        2. A UserForm Example
        3. More UserForm Examples
        4. A Dialog Box Checklist
      5. Chapter 19: Accessing Your Macros through the User Interface
        1. Customizing the Ribbon
        2. Customizing Shortcut Menus
    7. Part V: Putting It All Together
      1. Chapter 20: Creating Worksheet Functions — and Living to Tell about It
        1. Why Create Custom Functions?
        2. Understanding VBA Function Basics
        3. Writing Functions
        4. Working with Function Arguments
        5. Introducing Wrapper Functions
        6. Working with Functions That Return an Array
        7. Using the Insert Function Dialog Box
      2. Chapter 21: Creating Excel Add-Ins
        1. Okay … So What’s an Add-In?
        2. Why Create Add-Ins?
        3. Working with Add-Ins
        4. Understanding Add-In Basics
        5. Looking at an Add-In Example
    8. Part VI: The Part of Tens
      1. Chapter 22: Ten VBA Questions (and Answers)
      2. Chapter 23: (Almost) Ten Excel Resources
        1. The VBA Help System
        2. Microsoft Product Support
        3. Websites
        4. Excel Blogs
        5. Google
        6. Bing
        7. Local User Groups
        8. My Other Books
      3. Chapter 24: Ten VBA Do’s and Don’ts
        1. Do Declare All Variables
        2. Don’t Confuse Passwords with Security
        3. Do Clean Up Your Code
        4. Don’t Put Everything in One Procedure
        5. Do Consider Other Software
        6. Don’t Assume That Everyone Enables Macros
        7. Do Get in the Habit of Experimenting
        8. Don’t Assume That Your Code Will Work with Other Excel Versions
        9. Do Keep Your Users in Mind
        10. Don’t Forget About Backups
    9. About the Author
    10. Cheat Sheet
    11. Advertisement Page
    12. Connect with Dummies
    13. End User License Agreement