
VBA Automation for Excel 2019 Cookbook
Solutions to automate routine tasks and increase productivity with Excel and other MS Office applications
- 362 pages
- English
- ePUB (mobile friendly)
- Available on iOS & Android
VBA Automation for Excel 2019 Cookbook
Solutions to automate routine tasks and increase productivity with Excel and other MS Office applications
About this book
A comprehensive guide to gaining a 360-degree overview of the VBA programming language and learning how to build your own programs for automating routine tasks
Key Features
- Extend the capabilities of Excel and other Office applications with the help of Microsoft VBA
- Take your Excel programming skills to the next level by creating custom applications with dialogue boxes and the range object
- Automate repetitive and monotonous office work with VBA Excel programming
Book Description
Visual Basic for Applications (VBA) is a programming language developed by Microsoft to automate tasks in MS Office applications. This book will help you to focus on the essential aspects of your role by automating mundane tasks in Excel and other Office applications. With comprehensive coverage of VBA delivered in the form of practice problems and bite-sized recipes, this book will help you to hit the ground running.
Unlike most books that assume prior programming experience, this book starts with the fundamentals and gradually progresses to solving bigger problems.
You'll start by becoming familiar with VBA so that you can start recording macros right away. With this foundation in place, you'll advance to using the full capabilities of the language as you apply loops, functions, and custom dialog boxes to design your own automation programs. You'll also get to grips with embedded macros and other advanced tools to enhance productivity and explore topics relating to app performance and security. Throughout this VBA book, you'll cover multiple practice projects in Excel, Word, and PowerPoint while exploring tips and best practices to hone your skills.
By the end of this book, you'll have developed the skills you need to use VBA to create your own programs that control MS Office applications.
What you will learn
- Understand the VBA programming language's role in the context of the MS Office suite
- Discover various aspects of VBA programming such as its terminology, syntax, procedures, functions, and forms
- Investigate the elements, features, and characteristics of the VBA Editor to write and edit custom scripts
- Automate Excel sheets with the help of ranges
- Explore error handling and debugging techniques to catch bugs in your programs
- Create and use custom dialog boxes to collect data from users
- Customize and extend Office apps such as Excel, PowerPoint, and Word
Who this book is for
This book is for experienced Excel users, business analysts, finance professionals, and business users looking to boost their productivity by learning VBA programming to automate repetitive, tedious, or complex tasks. No prior programming experience is required to get started with this book.
Frequently asked questions
- Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
- Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app.
Information
Chapter 1: Getting Started with VBA
- Investigating VBA code
- Recording a macro
- Testing the macro
- Using the VBA Editor
- Editing the code by changing cell references
- Saving the file with an embedded macro
- Using the Trust Center for macro security
- Creating a customized ribbon
Technical requirements
Investigating VBA code
Getting ready
- Open MS Excel and select Blank workbook from the opening screen.
- Open the 01_VBA_Code.xlsm sample file. Click on [Enable Content] on the SECURITY WARNING ribbon.
- If the Developer ribbon is not visible, activate the Backstage View by clicking on File, which will display the following screen:
Figure 1.1 โ The Backstage View - From the category list on the left, select the last option, Options. The Excel Options dialog box appears:
Figure 1.2 โ The Excel Options dialog box - From the categories on the left, select Customize Ribbon.
- To the far right, under the Main Tabs heading, look for the Developer option. Select the checkbox.
- Click on OK to accept the change. The dialog box will close, and Excel will now display the Developer tab.
How to do itโฆ
- With 01_VBA_Code.xlsm open, click on the Developer tab:
Figure 1.3 โ The Developer tab - In the Code group (the first group on the left of the ribbon), select the Macros icon. The Macro dialog box opens:
Figure 1.4 โ The Macro dialog box - The VBA code we want to investigate is contained in the only macro: Area_Bold. Click on the Edit button. The Microsoft Visual Basic for Applications window will open. Maximize the window, if necessary:
Figure 1.5 โ The Microsoft Visual Basic for Applications editor window - In the code window (the large area on the right), a short VBA subroutine is displayed.
How it worksโฆ

Table of contents
- VBA Automation for Excel 2019 Cookbook
- Why subscribe?
- Preface
- Chapter 1: Getting Started with VBA
- Chapter 2: Working with the VBA Editor
- Chapter 3: The VBA Object Model
- Chapter 4: Working with Procedures
- Chapter 5: Next Level Recording
- Chapter 6: VBA Language Elements
- Chapter 7: Working with Ranges
- Chapter 8: Using Functions
- Chapter 9: Implementing Program Flow
- Chapter 10: Implementing Automation
- Chapter 11: Handling Errors
- Chapter 12: Debugging
- Chapter 13: Creating and Modifying Dialog Boxes
- Chapter 14: Creating UserForms
- Chapter 15: UserForm Controls
- Chapter 16: Creating Custom Functions
- Chapter 17: Creating Word Documents with Excel VBA
- Chapter 18: Working with PowerPoint in Excel VBA
- Other Books You May Enjoy