Copyright 2019 by Hein Smith - All rights reserved.
This document is geared towards providing exact and reliable information in regards to the topic and issue covered. The publication is sold with the idea that the publisher is not required to render accounting, officially permitted, or otherwise, qualified services. If advice is necessary, legal or professional, a practiced individual in the profession should be ordered.
- From a Declaration of Principles which was accepted and approved equally by a Committee of the American Bar Association and a Committee of Publishers and Associations.
In no way is it legal to reproduce, duplicate, or transmit any part of this document in either electronic means or in printed format. Recording of this publication is strictly prohibited and any storage of this document is not allowed unless with written permission from the publisher. All rights reserved.
The information provided herein is stated to be truthful and consistent, in that any liability, in terms of inattention or otherwise, by any usage or abuse of any policies, processes, or directions contained within is the solitary and utter responsibility of the recipient reader. Under no circumstances will any legal responsibility or blame be held against the publisher for any reparation, damages, or monetary loss due to the information herein, either directly or indirectly.
Respective authors own all copyrights not held by the publisher.
The information herein is offered for informational purposes solely and is universal as so. The presentation of the information is without contract or any type of guarantee assurance.
The trademarks that are used are without any consent, and the publication of the trademark is without permission or backing by the trademark owner. All trademarks and brands within this book are for clarifying purposes only and are the owned by the owners themselves, not affiliated with this document.
TABLE OF CONTENTS
Excel VBA
A Step-By-Step Guide To Learn And Master Excel VBA Programming
Part One:
For Beginning Programmers
Introduction
I want to thank you and congratulate you for purchasing the book Excel VBA: A Step-By-Step Guide To Learn And Master Excel VBA Programming. Now, you are one step closer to understanding how to use VBA Programing to make using Excel a piece of cake.
Excel VBA, or what coders might refer to as Visual Basic for Applications, is a built-in coding program found in Microsoft Offices Excel. This program is all about turning repetitive or complicated tasks into applications that Excel will run for you behind the scenes. By following the steps in this book, you will be able to create applications customized for your needs. In turn, these applications will help you use Excel more effectively and efficiently. Youll be able to accomplish what you do now in Excel in half the time!
And dont panic. This book was written with beginners in mind. So, no background in coding is required. Just follow the steps outlined in the book in order to accomplish the task you want, and you should see fast results. Also, keep in mind that the instructions provided in this book have been written using the Excel 2016 layout. If you are using a later version of Excel, these instructions will still work, but note that you might have to find the button or tab in a different location.
In total, this book contains fifteen chapters that each covers a basic function of Excel VBA. Many of these functions build off of each other. So, if you are new to VBA coding, its important that you start at the beginning and work your way through each chapter. Otherwise, some of the language or steps might be confusing. At the beginning of each chapter, you will find a list of definitions for the major terms that will be used throughout that chapter. Each chapter will also contain a step-by-step process for creating and running the function covered in the chapter as well as a way to practice the skill you just learned.
Thanks again for purchasing this book. I hope it will help you understand Excel VBA and help you accomplish your goals.
Chapter 1
VBA Overview
The acronym VBA stands for Visual Basic for Applications, and it is a hidden gem found in Excel. Using this function of Excel, you will be able to create applications customized for to your needs such as automatically analyzing a chart of data, using formulas to collect data, or creating dialogue boxes and customized user forms. Using Excel VBA does not require that you install any additional software. Instead, all you need is the basic Excel program available from Microsoft Office. The instructions in this book use Excel 2016 as the example, but you can perform all of these same functions with later versions of Excel.
As you progress through each chapter of this book, there are a few terms that you might find unfamiliar. Here, weve provided you with a short list of basic terminologies that you can refer to throughout your study of this chapter.
Macros : a program set of commands that run Excel functions automatically.
Dialogue Box : a sub-menu or small window that requires further action from the user to operate.
Before we can dive in to creating these amazing programs, we need to add the Developer Toolbar to Excel. This toolbar contains all the buttons that you will need to be a successful VBA Programmer. To add this toolbar, just follow the steps below:
How to display the Developer tab:
1- Open Microsoft Office Excel.
2- Click on the File tab, the first tab that currently appears on your toolbar.
3- Now click on Options. In Excel 2016, the Options button appears at the very bottom of the list.
4- After clicking on this tab, a dialog box will open that contains a lot of information. Right now, keep your attention focused on the left-hand column that contains a list of more tabs. Find the tab that says, Customize Ribbon. Click that tab.
5- After clicking on this tab, the dialogue box will change to show you two columns. The one on the left says, Choose commands from and contains a menu with all the popular commands. The column on the right says, Customize the Ribbon and shows a menu that lists all the current tabs on your toolbar. In this menu, find the box next to Developer, its near the bottom of the menu and check box.
6- Exit out of the dialogue box.
7- Look at your current toolbar now. It should contain the Developer tab near the end. It looks something like this:
With this tab installed, you are now ready to begin VBA programming!
Another task you might want to perform before beginning the lessons found in the other chapters is removing the security warning. This will allow you to run customized applications without having to go through the tedious process of accepting each application one-by-one. With the security warning disabled, you will be able to run all the applications you want without any warnings popping up. If you are not using a personal computer to run these applications, you might want to keep the security warning up. The security warning might also be helpful if you want the opportunity to double check the application before it runs each time. Its up to you to choose. But if you want to disable the security warning, simply follow the steps below: