VBA Tutorial

Best VBA Tutorial & Complete Resource for Learning VBA

Home/VBA Tutorial

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.

PREMIUM TEMPLATES LIMITED TIME OFFER

ON SALE80% OFF

BROWSE ALL TEMPLATES

50+ Project Management Templates Pack
Excel PowerPoint Word

VIEW DETAILS

Advanced Project Plan & Portfolio Template
Excel Template

VIEW DETAILS

Ultimate Project Management Template
Excel Template

VIEW DETAILS

20+ Excel Project Management Pack
Excel Templates

VIEW DETAILS

20+ PowerPoint Project Management Pack
PowerPoint Templates

VIEW DETAILS

10+ MS Word Project Management Pack
Word Templates

VIEW DETAILS


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

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.

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

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

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.

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

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

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

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

Excel VBA Macros for Beginners – 15 Examples File download

learn-vba-by-examples

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.

Macro Security in Excel VBA

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.

Inserting Columns in Excel Worksheet using VBA

Description: When we are automating any task we may required inserting columns between other columns or left/right side of a column using Excel VBA. For example, we may generate employee performance report based on their

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.

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, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA Program

VBA write to text file new line Excel

VBA code to write to text file new line Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA

VBA write to text file line by line Excel

VBA code to VBA write to text file line by line Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This

VBA write to text file carriage return Excel

VBA write to text file carriage return Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA Program and

VBA write to a text file Excel

VBA write to a text file Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA Program and function

VBA write to a text file with quotes Excel

VBA write to a text file with quotes Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript.This Example VBA Program and

VBA write to a text file from Excel Range

VBA code to write to a text file from Excel Range Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example

VBA write text file append

VBA code to VBA write text file append Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA Program

VBA write string to text file without quotes

VBA write string to text file without quotes Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA Program

VBA to append a text file Excel

VBA code to VBA to append a text file Excel Macros Examples for writing to text files using VBA in MS Office Word, PowerPoint, Access, Excel 2003, 2007, 2010, 2013 and VBScript. This Example VBA

VBA Remove Duplicates in Column in Excel

VBA code to Remove Duplicates in a Column in Excel Example Macros to delete duplicate records in columns of worksheet in MS Excel 2003, 2007, 2010, 2013. Example to show you how to delete duplicate

VBA Remove Duplicates in a Range in Excel

VBA code to Remove Duplicates in a Range in Excel Example Macros to delete duplicate records in Range of worksheet in MS Excel 2003, 2007, 2010, 2013. Example to show you how to delete duplicate

VBA to Remove Duplicates in ListBox Excel

VBA to Remove Duplicates in ListBox Excel Macros Examples Codes: to delete duplicate records from a List Box in MS Excel 2003, 2007, 2010, 2013. We will also see the practical example for deleting the

VBA Remove Duplicates in ComboBox

VBA to Remove Duplicates in ComboBox Excel Macros Examples Codes: to delete duplicate records from a Combo Box in MS Excel 2003, 2007, 2010, 2013. We will also see the practical example for deleting the

VBA Remove Duplicates from Array

VBA to Remove Duplicates from Array Excel Macros Examples Codes: to delete duplicate records from an array in MS Excel 2003, 2007, 2010, 2013. We will also see the practical example for deleting the duplicates

VBA to Remove Duplicate Rows in Excel

VBA code to remove duplicate Rows in Excel: Example Macros to delete duplicate records from worksheet in MS Excel 2003, 2007, 2010, 2013. Example to show you how to delete duplicate records from Excel Worksheet.

VBA Programming

VBA programming for beginners and advanced users will help you to learn vba programming language and concepts. Our objective of this topic is to provide complete programming reference to write VBA Programs. VBA Programming Learning Objective

VBA Delete Row – Excel Examples Macros Codes

Excel VBA code to Delete Rows examples Macros will help us to delete rows from excel worksheet in various criteria. We can use VBA delete row macros to delete entire row, blank cells or empty

Open a File using FollowHyperlink Method

VBA code to open a file using Followhyperlink method will help you opening a workbook or anything using Excel VBA. VBA open file example we will see how to open a excel workbook using VBA.

VBA Sort Data Excel Example Macro Code

VBA code to sort data in Excel example will help us to sort data in excel worksheets in Ascending or Descending order. We can use Sort method of Excel Range to sort the data. In

VBA Save Sheet as Workbook Excel Macro Code

VBA code to save sheet as Workbook example code will help us to save a specific sheet as new workbook. We can use Copy and SaveAs methods of Workbook to copy and save the sheet

VBA Save Excel File Example Macro Code

VBA code to save the excel file example code will help us to save the excel file. We can use Save method of Workbook to save the file. In this example we will see how

LIMITED TIME OFFER - Get it Now!
Advanced Project Plan Excel Template

 
Related Resource External VBA Reference

6 Comments

  1. NARENDRA T July 3, 2016 at 11:12 AM - Reply

    I Need Complete Macro Coding Tutorial Form Beginner Level To Advanced, Please Help Me Out.
    Thank You.

  2. quentin zavala August 4, 2016 at 12:44 AM - Reply

    10-but I would like more up-to date information

  3. sergio April 2, 2017 at 1:52 AM - Reply

    How can I place an xy scatterplot chart inside a form and dynamically update?
    Thanks in advance.

    • PNRao April 4, 2017 at 2:09 PM - Reply

      Hi, We can not place Chart objects in the UserForms.

      Alternatively, you can build the chart in the worksheet and save it as image and load into the UserForms using Picture control.

      Thanks!

  4. Joe October 8, 2017 at 9:46 PM - Reply

    Excellent Tutorial! Thanks for all your work.

  5. James April 4, 2018 at 5:50 PM - Reply

    These step by step VBA tutorial is very Clear and straight to the point.

Leave A Comment

This site uses Akismet to reduce spam. Learn how your comment data is processed.