VBA Tutorial For Learning Excel VBA from basics to advanced topics. Free VBA tutorial will make you expertise in VBA Automation with Best free tutor. Our easy to follow tutorials will make you expertise in the subjects which are required for VBA Development. We explain the topics in a smarter way with real-time examples from different domains. You can also download the Example Macro Files and Learn VBA with clearly explained code in each topic.
VBA Tutorial: Learning Path
VBA Topics | Learning Objective |
---|---|
Introduction to VBA | In this topic we will try to understand basics in Excel VBA. What are the different things we can do with VBA? |
Getting Started with VBA | n this session we will briefly discuss and see the different things which we are required to learn to Record Macros. |
VBA Environment | VBA Environment we also refer as VBE. You can goto Developr tab in the ribbon and Click on the Visual Basic button to go to the VBE or simply press ‘Alt+F11’ to go to the VBE |
Recording a Macro | It will take you through how to record a macro in Excel VBA for the following example. |
Writing Your First VBA Macro- Hello World! | we will see how to write simple Hello World VBA macro. Follow the below steps to do this to show the “Hello World!” message box to the user. |
Debugging VBA Code | |
Accepting Values (Input Box) & Popup Messages (Message Box) | Accepting Values and Popup Messages in Excel VBA – In this example we will see how to Accepting Values from user using InputBox and Show Popup Messages to user using MsgBox. |
Modifying and Commenting Macros or VBA Code | When you are writing the program you may want to test whether particular statement is working fine. Debug Code in Excel VBA is the one of important task while writing programs, it helps you in troubleshooting your code. |
Executing a Macro | We can execute a macro in many different ways, in this topic we will learn Running macro in Excel: From Macro Dialog and By assigning a short-cut key to the Macro |
Macro Security | Macro Security in Excel VBA is provided to secure your data or PC from others or from the malicious programs. Learn more about macro security here. |
Learn Macros with Examples – 15 Basic Macros for Absolute Beginners | These 15 novice macros provides the easiest way to understand and learn the basics of VBA to deal with Excel Objects. |
Scope of the Variables | When we are working with variables, it is important to understand the Scope of a Variable. The Scope describes the the accessibility or life time or visibility of a variable. |
Passing Arguments | We write the procedures to perform certain tasks and some times we may required to write another procedure with small variations. In this situation we can take advantage of the Passing Arguments. |
Arrays | When we work with one item we required to use one variable, if you want work with more than one item, we can go for Arrays in Excel VBA. Arrays are the variables which allow us to store more than one value. |
Introduction to Collections | Collection in Excel VBA helps to loop through the group of items: |
UserForms and Controls | Any Windows Application is equipped with set of objects called windows controls. Forms and Controls in Excel VBA topics give you the complete understanding of developing application with Forms and Controls |
Events | Events in Excel VBA help us to write event enabled programming. In this tutorial we are explaining basic of Event Programming and frequently used events with examples. You can download the example file and explore it. |
Objects, Properties and Methods | Understanding VBA Objects Properties and Methods in Excel is important, most of the programming languages today are Object Based Or Object Oriented Programming Languages. |
VBA Security | It is important to understand the macro or VBA Security in Excel if you are dealing with the Macro Enabled Files. It helps to protect your data from the malicious programs and helps to know how to run the macros when its required. |
Introduction to ADO and SQL : Connecting to a database with VBA | ADO Excel VBA – SQL Connecting to Database Example Macros helps to connect the different data sources from Excel VBA. Select, Delete,Update Records set. |
Interacting with Other Applications | We can Interacting with Other Applications using VBA- with the MS Office Applications like Word, PowerPoint,Outlook,etc… and other applications like Internet Explorer, SAS,etc. |
Latest Excel VBA Tutorials
VBA ActiveSheet – Excel Active Sheet Object
VBA ActiveSheet Object helps to refer the currently activated sheet in the active workbook. We can get all properties and methods of the ActiveSheet using VBA. Let us see the useful of the examples on
Excel VBA ColorIndex
VBA ColorIndex Property of Excel VBA is very useful to set the fill colors, border colors and font colors. Excel VBA ColorIndex returns index values from 1 to 56, -4105 and -4142. You can set
Excel VBA Copy Range to Another Sheet with Formatting
Very often we need to copy the Excel Range to another sheet with formatting. We can use VBA to automate this task. Excel VBA Copy Range to Another Sheet with Formatting macro is explained to
Show or Hide|Unload a userform
Show or hide means to display or hide a Userform. We use Show and Hide methods to display or hide. Unload will be used when completes the task.
Column Number to Column Name
Column Number to Column Name is nothing but converting column number to Excel alphabetic character column name. Most of the time while automating many tasks using Excel VBA, it may be required.
Column Name to Column Number
Column Name to Column Number is nothing but converting Excel alphabetic character column name to column number. Most of the time while automating many tasks it may be required. Please find the following details about conversion of column name to column number. You can also say column string to column number. Or get alphabetic character to column number using Excel VBA.
Remove CheckBox on Worksheet or UserForm in Excel
We can remove or delete checkbox on the worksheet or userform using ‘Go To Special’ or ‘Select Objects’ or by turning on Design Mode in Developer tab. when we don’t want to place checkbox control on the worksheet or userform we removes from there. Please find the more details and screenshots for clear understanding about remove checkbox control in the following chapter.
Add CheckBox on Worksheet or UserForm in Excel
Add CheckBox on Worksheet or UserForm is using checkbox control and is used to specify or indicate binary choice. In this section we will see how to add single checkbox or multiple checkboxes on the worksheet or userform. Please find more details about add checkbox control in the following chapter.
Remove Alpha Special characters from Range using Excel VBA
Examples using Procedures and Function to Remove Alpha Special characters from Range using Excel VBA to get only numeric data from specific range.
Excel Chart VBA Examples and Tutorials
Here are the top most Excel Chart VBA Examples and Tutorials, show you how to deal with chart axis, chart titles, background colors,chart data source, chart types, series and many other chart objects.
Introduction to Collections in Excel VBA
Collection is an object contains group of objects having similar characteristics (with same properties and methods). For example,if you want to loop through all worksheets in a workbook, you can refer worksheets collection of the workbook and do whatever you want to do with that particular worksheet.
In this topic:
- Introduction to Collections?
- Collections in Excel VBA
- Examples Macro File On Collections
VBA ComboBox Excel Macros Examples Codes Adding Clearing Items
ComboBox in Excel VBA-Adding new Items,Adding new Items to another ComboBox based on selection of first ComboBox ,Clearing,Example Tutorials and Codes
ListBox in Excel VBA – Adding, Clearing, Multiple Selection Examples
ListBox VBA Excel Example Macros Codes for Adding new Items,Moving all Items, selected Items from ListBox to another ListBox,clearing,Multi selection. VBA ListBox in Excel is one of finest control in the Excel. You can show
ADO in Excel VBA – Connecting to database using SQL
ADO Stands for ActiveX Data Objects, is Microsoft’s Client-Server technology to access the data between Client and Server. ADO can’t access the data source directly, it will take help of OLE DB Provider to communicate with the data source. Most of the times OLE DB providers are specific to a particular Data Source Type. However, we have an OLE DB provider for ODBC, it is a general purpose provider with help of this ADO can access any Data source which can understand ODBC.
In this topic:
- What is ADO?
- What is Database?
- What is SQL?
- Practical Learning: Using ADO and SQL with VBA
- Example File
Events in Excel VBA
Event programming is the most useful tool which helps to monitor specific user actions within Excel. For example, if the user Opening a Workbook, Selects a Worksheet, enters data into a Cell, or saves a Workbook, these actions are all Excel Events.
In this topic:
- What Are Events?
- What Are The Different Types of Events?
- Practical Learning: Workbook_Open Event
- Example File: Workbook Events, Worksheet Events and Form Events
Procedures in Excel VBA
In this Section:
- What is a Sub Procedure?
- Calling a Sub Procedure
- Procedures and Access Levels
- Examples on Sub Procedures - With and With Out Parameters
- Example File
Conditional Statements in Excel VBA – If Else, Case, For, Do While, Do Until, Nested Ifs
Conditional statements in Excel VBA helps to control the programming. Learn IF,If Else, Nested If, Case, For, Do While, Do Until statements with examples.
Operators and Operands in Excel VBA
Operators and Operands in Excel VBA very useful concept to programming the tasks. Our free tutorials take you through the concepts with examples .
Variables and Data Types in Excel VBA
Variables and Data Types in Excel VBA are another important concept to write the programs in VBA for automating tasks. Free tutorial to learn with examples.
Merge UnMerge Cell Range in Excel VBA
You Merge UnMerge Range in Excel VBA, it is required if you want to make bigger cells, instead of existing cell to fit your data and needs.
Objects in Excel VBA – Workbook, Sheets, Range and Cell
Objects in Excel VBA. Tutorials to learn how to deal with different objects in Excel VBA - Workbook, Sheets, Range and Cell with Example codes to acsess it.
Tables in Excel VBA – Explained with Examples!
Managing the data with Tables is very easy in Excel VBA - Examples to show you Creating,Sorting, Filtering Tables and Clearing or Toggling Table Filters.
Names in Excel VBA – Explained with Examples!
Defining Names in Excel makes our job more easier - VBA Examples to show you Adding Names ,Deleting Names and Hiding and UnHiding Names in Excel VBA.
Excel VBA Object Model
Tutorials for understanding Excel VBA Object Model. Understanding the VBA Object Model is important to deal with different Excel Objects. Learn more here...
Folders and File Handling in Excel VBA
Folder and File Handling in Excel VBA Examples help you to create, delete,copy,move files and folder. And customize File or Folder dialog Box using VBA.
Delete Files Using VBA
Example code for Deleting Files Using Excel VBA by using DeleteFile method of FileSystemObject
Copy Data from one Worksheet to Another in Excel VBA
This example will show you how to copy data from one worksheet to another worksheet in Excel VBA. Also explained different methods of copying data in VBA.
Copy Data from One Range to Another in Excel VBA
This example to show you how to copy data from one Range to another using Excel VBA. This is one of the frequently used codes in the VBA, we often do this.
Clear Cells in Excel Range Worksheet using VBA
Examples to show you clear cells in Excel form a Range or Worksheet. Various examples provided to show the proper use of Clear and ClearContents Methods.
Add Clear Comments in Excel VBA
Comments are helpful when you want to show some remarks or comments on particular cell, you can Add Clear Comments in Excel VBA.
Interacting with Other Applications using VBA
We can interact with the other applications using VBA - with the MS Office Applications like Word, PowerPoint,Outlook,etc... and other applications like Internet Explorer, SAS,etc.
In this Section:
- Introduction?
- How to interact with MS Word? - Late Binding
- How to interact with MS Word? - Early Binding
- How to interact with PowerPoint? - Early Binding
- How to interact with Outlook? - Late Binding
- Example File
Getting Started with VBA Programming
Getting Started with VBA - Welcome to VBA programming tutorials, In this session we will see brief introduction of the topic required to understand VBA programming.
VBA Security in Excel
It is important to understand the macro security if you are dealing with the Macro Enabled Files. It helps to protect your data from the malicious programs and helps to know how to run the macros when its required.
In this Section:
- Understanding VBA Security
- What are the different Levels of the Security in VBA?
- How to Enable or Disable the Macros?
- How To Protect VBA Code?
VBA Objects Properties and Methods in Excel
Most of the programming languages today are Object Based Or Object Oriented Programming Languages. Although Excel VBA is not a truly object oriented programming language, it does deal with objects.
In this topic:
- What are Objects?
- What are Properties?
- What are Methods?
- What is Object Browser?
Forms and Controls in Excel VBA
Any Windows Application is equipped with set of objects called windows controls. The Main control is called a Form, it is the primary window contains different types of controls which allow user to interact with the computer. The following is a simple form to calculate square value of a given number.
In This Section:
- What Are UserForms?
- What Are ActiveX Controls?
- What Are The Different UserForm Controls & Use?
- Practical Learning: Developing A Simple UserForm
- Example File
Change Row Height and Column Width using Excel VBA
This example will show you how to change row height in excel using VBA. Learn more about VBA and related topic here with examples, Files and explanation.
Write Data to Worksheet Cell in Excel VBA
Description: In the previous post we have seen, how to read data from excel to VBA. We will see how to write data to Worksheet Cell in Excel VBA. Write Data to Worksheet Cell in
Passing Arguments in Excel VBA
We write the procedures to perform certain tasks and some times we may required to write another procedure with small variations. In this situation we can take advantage of the Passing Arguments.
In this Section:
- What are By Value (ByVal) and By Reference (ByRef) Passing Arguments?
- Writing a procedure or a function with Arguments
- How to call a function or a procedure?
- Example macro file to explain passing arguments
Change Font Color in Excel VBA
Examples will show you how to change Font Color in Excel using VBA. While preparing the reports we change the font colors based on data Or a template.
Arrays in Excel VBA
When we work with one item we required to use one variable, if you want work with more than one item, we can go for arrays. Arrays are the variables which allow us to store more than one value.
In this topic:
- What is an Array?
- What are the different types of arrays?
- One Dimensional Array:
- Multi-Dimensional (Two Dimensional) Arrays:
- How to Re-size an Array?
- Array Options
- Example File
Read or Get Data from Worksheet Cell to VBA in Excel
It is very simple to Read or Get Data from Worksheet using VBA, There are may ways to read the data from Excel to VBA. See the examples explained Here.
Delete Rows and Columns in Excel VBA
We can delete rows in Excel using VBA. We can specify a condition to delete. There are number of examples to show you dealing with deleting records in Excel
Scope of Variables in Excel VBA
When we are working with variables, it is important to understand the Scope of a Variable. The Scope describes the the accessibility or life time or visibility of a variable. There are four levels of Scope:
- Procedure-Level Scope
- Module-Level Scope
- Project-Level Scope
- Global-Level Scope
Copy Files from One Location to Another folder or directory in Excel VBA
Examples to Copy Files from One Location to Another folder or directory in Excel VBA - if File does not exists in the source or already in the destination.
VBA Code Excel Macro Examples Useful 100+ How Tos for Basic and Advanced Users
100+ USEFUL VBA CODES & MACROS
The Most Useful VBA Codes & Macros! Do Almost Everything! We have explained verity of examples to cover most frequently used codes.
- Basics & Excel Objects
- Application.Object
- Dealing with Other Applications
- Hyperlinks
- File Handling
- Charting
- Pivot Tables
- Miscellaneous
Check if file Exists in Location using Excel VBA
Example code to Check if file Exists in Location using Excel VBA. We can use FileSystemObject and FileExists, Dir functions.
Excel VBA Macros for Beginners – 15 Examples File download
Learning Basic Excel VBA By Examples is the easiest way to understand the basics of VBA to deal with Excel Objects, in this tutorial we will not covering any programming concepts, we will see how to access the different Excel Object using VBA.
Hyperlinks in Excel VBA – Explained with Examples!
Hyperlinks in Excel VBA - Examples to add, create and remove hyperlinks, opening files using hyperlinks and sending emails using hyperlinks in Excel VBA.
Excel VBA to Interact with Other Applications
Another powerful feature of Excel VBA is to interact with Other Applications - Examples to deal with MS Word, PowerPoint, Access, Internet Explorer,etc.
Finding last used Column with data in particular Row – Excel VBA Examples
Description: There are certain situations where we perform some tasks by finding last used Column with data in a Row. For examples, There may be 100 rows and each row may have the data in
Latest VBA Tutorials
VBA Filter Multiple Columns
VBA to filter Multiple Columns code helps applying the filters in multiple columns. Let us see the example macros to filter the records or rows based on items in multiple columns using VBA. Example Data
VBA Filter Column
VBA filter column macro helps filter the data in a specific Column. Let us see different example macros to filter the records or rows based on items in one column. Example Data to Explain the
VBA Autofilter – Excel Explained with Examples
VBA Filter function is very useful for filtering the records to suit our requirement. We use VBA Filter function to filter the records with verity of criteria to get the limited number of records. Sometimes
Hide Developer Tab in Excel Ribbon
Hide Developer Tab in Excel Ribbon using from the Excel options. It helps to prevent users from opening the Excel VBA editor window. Hide Developer Tab in Excel Ribbon: Right click on any main menu
Add CheckBox on Worksheet or UserForm using VBA
We can add CheckBox on Worksheet or UserForm is using VBA with checkbox control and is used to specify or indicate boolean choice. In this section we will see how to add single checkbox or multiple checkboxes on the worksheet or userform using VBA. Please find the more details about add checkbox control using VBA in the following chapter.
Optimize VBA Code to run Macros Faster
Optimize VBA code to run macros faster, simple, easy to understand and efficient way of writing macro. Please find the more details and examples.
Show Developer Tab in Excel Ribbon
Developer Tab in MS Office tools helps programmer to navigate VBA editor, recording macros to automate repetitive tasks and to write VBA programs to develop applications.
Copy Worksheet
Copy worksheet in VBA is used to Copy the worksheet from one location to another location in the same workbook or another new workbook or existing workbook.
Move Worksheet
Move worksheet in VBA is used to move the worksheet(s) from one location to another location in the same workbook or another new workbook or existing workbook.
VBA code to convert excel to xml
We can use VBA to convert and Save the Excel File as XML file. This example macro will help us to know how to convert Excel Worksheet into a XML file format. This can be
VBA to call Worksheet function
We can use worksheet function in the VBA macros. We can call the worksheet functions using Application.WorksheetFunction. We can call any Worksheet function and use in our code. the below example will show you how
VBA code to call a function
The below example will help you to know how to call a function in Excel VBA Macros (it can be Excel VBA function, or user defined function). We generally create lot of function and we
VBA code to convert excel to csv
We can use VBA to convert and Save the Excel File as CSV file. This example macro will help us to know how to convert Excel Worksheet into a CSV Comma delimited text file. This
VBA code to check if active cell is blank
VBA to check if an active cell is blank macro will help us to determine whether an active range is filled with some value or not. This example will help us to know how to
VBA code to check if a cell is blank
We can use VBA to check if a cell is blank and run the remaining statements. Sometimes, we need to determine and make sure a particular range is not empty before proceeding to the next
VBA write to text file without carriage return Excel
VBA write to text file without carriage return Excel Macros Examples for writing to text files using VBA in MS Office Word, Po