Learn VBA Online - Getting Started with Writing MACRO Codes in Excel
Home ➜ Learn VBA Online – Getting Started with Writing MACRO Codes in Excel
This VBA thing is Popular among all the Excel users. Everybody wants to write codes in Excel and wants to automate their stuff.
Why I’m saying this?
Well, all the emails which I receive from my audience, 85% of them are related to VBA.
People out there want to learn VBA. Don’t You?... Yes?... That’s Great.
If you do repetitive activities every day in Excel, like copy pasting data, creating charts, pivot tables, the best way is to write codes to automate them.
Learning VBA can be WIN-WIN for you. Getting excited yet? You should be!
And let me tell you something, this is one of the best and comprehensive guide you can find on the internet to learn to use Visual Basic Application in Excel.
This guide will not only help you to get started with VBA but also inspire you to be life long VBA learner.
Why Did I Write This Guide?
Just like you when I started with VBA, the only problem which I have faced that there’s was no structure on the internet which I could follow.
Do you know where to start and which thing to learn first? Confused, Right?
That’s my point. You need a structure.
A structure to follow which can help you to learn things step by step and that’s what you will get in this guide.
Another strong reason is before learning VBA and started to use it I had never done coding and I want to help all those non-coder humans who want to get started with VBA.
How Much of This Guide Should I Read?
Yes, you head it right. If you're serious about learning VBA and want to have a solid base you must read this entire guide first to last.
This guide has 10 CHAPTERS which you should follow in sequence to learn each topic in detail and make sure to practice what you learn after each chapter.
In each chapter, you can download all the code which I have used in examples.
You can have the pace that suits you best, and be sure to practically perform each every step mentioned in the chapters.
What You Can Learn from this Guide?
This guide is designed to describe all major aspects of VBA, from recording a macro to writing your first VBA code to create a user-defined function.
This will help you to learn these things one by one.
For learning VBA and start using it wants you to have clarity about the concept and this guide is for this.
Learning VBA can be super fun.
Here’s What You’ll Find in this 10 Chapters VBA Guide
As I said, the best part of this guide is it is well structured (divided into 10 chapters) and you just need to follow it chapter by chapter.
In CHAPTER 1, you’ll learn about the following things which will help you to understand the VBA as a programming language:
- What is VBA: If you are a beginner (weather using Excel or not) you need to what actually this language is all about.
- Advantages of VBA: As I said with VBA you can automate all the almost all the activities you do in Excel.
- How it Works with Excel: Before you start using VBA, you need to learn how it works with Excel + other things you need to know.
In CHAPTER 2, you’ll learn about the two most important things which can help you to work in a better way with VBA.
In CHAPTER 3, you will learn about creating your first macro code by recording it and then writing your first macro code from scratch.
- Recording Your First Macro: In Excel, you can use the macro recorder to record macro code for the activities you perform.
- Cleaning Up Recorded Macro: Once you learn to record a macro then the next thing is to clean the recorded code.
- Using Relative Reference: While Recording Macros you must activate the relative reference to make a VBA code flexible.
In CHAPTER 4, you will learn to write a VBA code from scratch, and different ways to run it and using comments.
- Writing Your First Macro Code: Real thing starts when you start writing codes. The more codes you write the more efficient you become.
- Different Ways to Run a VBA Code: There are multiple ways which you can use to run a code in your Excel files.
- Writing Clean Structured Coding: Using comments is a good habit and can help anyone to understand the code.
In CHAPTER 5, you will learn about types of procedures, using variables and constants and defining the scope of procedures.
- Sub/Function Procedure: All the codes you write in VBA called Procedures and there are two different ways you can write them.
- Defining Variables and Constants: Variables and Constants help you to store values and use those while executing the code.
- Date Types: It's important while declaring variables and constant to define the data type for it.
- Defining Scope: You can define the scope of your procedure if you want to use it in other procedures and modules.
In CHAPTER 6, you will learn about writing codes to create conditions and Loops with VBA.
In CHAPTER 7, you will learn about Objects, Methods, Properties, and Events and how to use them in your codes.
- Objects: Your Excel workbook is made up of objects and to use all those objects you need to learn to refer to them in your codes.
- Properties: Each object has some sort of properties which you can access and make changes into.
- Methods: To do something with an object you need to know about methods.
- Events: You need to learn about using events if you want to trigger your macro codes when an event happens.
In CHAPTER 8, you store all your data into cells, so it’s important to know how to use (RANGE OBJECT) cell and ranges.
In CHAPTER 9, you will learn about using Message Box and Input Box to interact and to get a response from the user.
In CHAPTER 10, you will learn about VBA errors and their types. And after that, you will learn all the possible ways to deal with them.
- What is VBA Errors: Just like other programming languages, in VBA, there also some errors which you will be facing.
- Error Settings in VBA: Before you start writing your codes, make sure to have your error setting checked.
- Type of Errors in VBA: There are four different types of errors which you could face while using VBA.
- Using Debug Tools in VBA: Once you are done with your code it's always better to debug it and check out for all the possible errors.
- Using Error Statements: These statements help you to skip the errors and move on with the code or run a specific code instead.
- What Else I need to Know: Err Object can help you get more about the error occurred in your code.