Training videos for learning EXCEL VBA - BASICS

We have 24 Excel VBA - Basics videos listed below. You might also like to consider booking a place on one of our online or classroom VBA courses, where you will meet the owls behind the videos!

Excel VBA Part 1 - The VB Editor

Posted by Andrew Gould on 10 May 2013

Before you can start writing VBA code for Excel you need to understand how to use the tool that you'll use to do your programming. This video teaches you how to get started using the Visual Basic Editor, including how to get into the application from various versions of Excel, how to work with the various windows, how to modify the default settings and how to work with modules. You won't learn how to write any code here, but this video will ensure your life will be as easy as possible when you do!

Excel VBA Part 2 - Writing Your First Macro

Posted by Andrew Gould on 10 May 2013

VBA, or Visual Basic for Applications, is a powerful tool that you can use to automate Microsoft Excel. This video introduces you to the basics of writing code in the VB Editor, including how to create a new module, how to write a subroutine, some best practice guidelines for laying out your code and adding comments, and how to write simple VBA instructions. We'll also show you how to run the simple procedure that you'll write, and how to ensure that you can save your code and reopen the file which contains it.

Excel VBA Part 3 - What To Do When Things Go Wrong

Posted by Andrew Gould on 10 May 2013

If you've written at least one subroutine in VBA you'll probably already be familiar with the feeling of frustration when things don't work! This video teaches you about the different types of error that you're likely to encounter when programming in VBA and what to do when things go wrong. You'll learn the difference between syntax, compile and runtime errors, when each type is likely to happen and we'll even show you a few useful debugging techniques to help you when you're trying to figure out what went wrong!

Excel VBA Part 4 - Buttons, Toolbars and Keyboard Shortcuts

Posted by Andrew Gould on 10 May 2013

As a developer you'll be used to running most of your code from within the Visual Basic Editor environment. Your users, on the other hand, are more likely to require a simple interface (most likely involving buttons to click) that they can use to run your code. This video covers the main ways to provide users with the means to run your code including keyboard shortcuts, buttons and drawing objects with attached macros. We'll even show you how to customise the ribbon and toolbars in Excel for that extra, professional touch!

Excel VBA Part 5 - Selecting Cells

Posted by Andrew Gould on 23 May 2013

You won't get far in Excel VBA without understanding how to refer to cells! This fairly long video covers most of the common, and some uncommon, techniques for selecting and referring to cells. You'll learn how to select cells by cell reference using the Range property, how to refer to cells by row and column number using the Cells property, and how to refer to the currently selected cell using the Activecell property. We also cover how to select multiple cells and how to refer to range names as well as a variety of relative selection tricks such as using the End property to jump to the bottom of a list, using the Offset property to move a specific number of rows and columns, and how to select an entire region of data with one simple instruction. Along the way you'll also learn several techniques for formatting and modifying cells, as well as how to copy and paste data in VBA.

Excel VBA Part 6 - Worksheets, Charts and Sheets

Posted by Andrew Gould on 09 November 2013

In order to navigate a workbook using VBA it's essential to understand how to refer to, activate and select the various types of sheet. This video explains the difference between worksheet, chart and sheet objects and also demonstrates how to select, copy, move, delete and rename them. You'll also see how to change the visibility of the sheets in a workbook, including how to make sheets not just hidden, but VERY hidden!

Excel VBA Part 7 - Working with Workbooks

Posted by Andrew Gould on 17 January 2014

This video explains the basics of working with Workbooks in Excel VBA. You'll learn several techniques for referring to workbooks, including the difference between ActiveWorkbook and ThisWorkbook. You'll also find out how to open existing workbooks and create new ones, including how to create a workbook based on a template. Finally, the video looks at various techniques for saving files, including how to provide a filename and a location, and how to change the file type.

Excel VBA Part 8 - Variables in VBA

Posted by Andrew Gould on 21 January 2014

Variables are essential in all sorts of programming languages, and VBA is no exception. This video takes you through the basics of working with simple data-type variables and will explain the difference between non-declared and explicitly-declared variables, including why explicitly-declared variables are worth the effort! You'll see how to choose the best data type for your variables as well as learn about the consequences if you get it wrong. Finally you'll find out what the 'scope' of a variable means and how to set the scope appropriately for the subroutine that you're writing.

Excel VBA Part 9 - Object Variables

Posted by Andrew Gould on 22 January 2014

Object variables in VBA allow you to store references to objects in memory. They're slightly more complex to use than basic data-type variables, but well worth the effort and this video explains why! You'll learn how to declare object variables and how to set references to existing objects. The video also shows you how to return references to objects using the methods of other objects with examples including generating new workbooks and worksheets, as well as using the Find method to reference cells.

Excel VBA Part 10 - Message Boxes

Posted by Andrew Gould on 23 January 2014

Message boxes in VBA provide a convenient way to display information to a user. This video shows you all you need to know to get started with showing messages, customising the message box and using it to ask users for input.

Excel VBA Part 11 - Input Boxes

Posted by Andrew Gould on 27 January 2014

In VBA an Input Box is a convenient way to ask users for information. This video shows you how to display and customise a basic inputbox, and how to capture the result using cells or variables. You'll also see what happens if a user cancels from the inputbox and how to test if that happens. The final part of the video goes into more technical detail on returning inputbox results to variables with different data types.

Excel VBA Part 11a - Application.InputBox

Posted by Andrew Gould on 03 November 2014

If you've used the generic InputBox function in VBA you may be frustrated by its limitations. This video shows you how to use the far superior Application.InputBox method. You'll learn how to specify the data type returned by the InputBox and how to use its built-in validation feature to control what users can enter. The video also covers how to return a simple formula and a more complex function from the InputBox and also how to allow users to select a range of cells which can then be referenced by your VBA code. The final part of the video covers a more complex example in which the InputBox returns an array of values which can be looped over and manipulated in various ways.

Excel VBA Part 12 - With Statements

Posted by Andrew Gould on 30 January 2014

A With Statement in VBA is a great way to make your code a lot neater and a bit more efficient. This short video shows you how to use With statements in your code and explains why they can be so useful.

Excel VBA Part 13.1 - If Statements in VBA

Posted by Andrew Gould on 31 January 2014

An IF Statement allows you to test whether a condition is met and then perform different actions based on the result. This video takes you from writing simple IF statements, through nested Ifs, ElseIfs and even how to combine logical tests using the And and Or operators.

Excel VBA Part 14.1- Select Case Statements

Posted by Andrew Gould on 03 February 2014

Select Case statements in VBA are similar to If statements in that they allow to test whether conditions are met and perform different actions based on the result. This video explains how to use Select Case statements in your code, including the various ways to phrase a logical test, how to separate numbers into bands, how to test for lists of values and how to create nested Select Case statements.

Excel VBA Part 15.1 - Do Until and Do While Loops

Posted by Andrew Gould on 06 February 2014

Do Loops in VBA allow you to carry out a set of instructions repeatedly until some kind of condition is met. This video teaches you about the basics of the Do Loop statement including how to write Do Until and Do While loops, where to place your conditional statements and how to exit from a loop. The final part of the video provides a couple of longer examples using Do Loops.

Excel VBA Part 16 - For Next Loops

Posted by Andrew Gould on 07 February 2014

You can use a For Next Loop to tell your program to repeat a set of instructions a number of times. This video teaches you how to construct a For Next statement, how to control how many times your loop will run, as well as which direction it will run in. The video also includes several practical examples of using a For Next Loop to process the items in a collection such as worksheets, workbooks and cells.

Excel VBA Part 17 - For Each Loops

Posted by Andrew Gould on 10 February 2014

A For Each Loop is used to loop over a collection of objects and there are lots of good reasons for wanting to do that in Excel VBA! This video takes you from the basics of the For Each Next statement and using object variables through several examples of looping over worksheets, workbooks, chartobjects and cells and, finally, into writing nested loops for even more power.

Excel VBA Part 18 - Creating Functions

Posted by Andrew Gould on 17 February 2014

A VBA function is a procedure that can return a value and this video teaches you how to create them. You'll learn how to declare a function and how to add parameters, including optional parameters and default values. You'll also see several ways to call the functions you've written, including from other VBA procedures and from an Excel worksheet. The video also talks about how to rewrite existing subroutines to replace repetitive code with functions.

Excel VBA Part 19 - Error Handling

Posted by Andrew Gould on 24 February 2014

Almost every procedure you write in VBA has the potential to go wrong at some point! Writing error handling code allows your procedures to fail gracefully instead of dumping the user out into the run time error dialog box. This video teaches you all about the On Error statement including how to ignore errors, how to trigger a custom error handler and how to resume running your code after an error has occurred. Towards the end of the video you'll also encounter the Err object which allows you to interrogate the error that has occurred and even raise your own custom errors.

Excel VBA Part 20 - Event Procedures

Posted by Andrew Gould on 28 February 2014

Writing Event Procedures allows you to create subroutines which run automatically in response to events in a workbook. This video teaches you how to access the events of an object and start writing event procedures for both workbooks and worksheets. You'll also see how to cancel certain events and how to disable events, as well as how to use the parameters of an event procedure.

Excel VBA Part 21 - User Forms

Posted by Andrew Gould on 28 February 2014

Designing a User Form in VBA is a great way to allow you users to interact with your workbook. This video teaches you how to create forms, how to add controls and manipulate their properties and how to add code the events of the form to make it respond to user actions. You'll also get an insight into how much code goes into performing even very simple validation to control what your users can do with the form.

Why do we write If Not Is Nothing in Excel VBA?

Posted by Andrew Gould on 03 April 2021

This video explains how to write a variety of logical tests using If statements in Excel VBA. You'll learn the long and short versions of testing if something is True or False and the difference between testing a value and a reference to an object. You'll see how to use the Is keyword and the Not keyword and understand why we sometimes write the pattern "If Not ... Is Nothing Then".

How do I hide all but the selected sheets in Excel?

Posted by Andrew Gould on 10 August 2021

This video explains how to use the SelectedSheets collection to hide all the unselected sheets in a workbook using Excel VBA.

This page has 10 threads Add post
17 Sep 19 at 18:15

Dear Wise Owl,

How can I use VBA to copy one specific sheet from each workbook which located from one path to current workbook?

The specific sheet will be named as the same as the name from each file in the current workbook.

Thanks in advance!

19 Sep 19 at 09:08

We don't usually answer technical queries (we'd never get any of our training or blog/video development done otherwise), but I'll leave this question on her in case anyone else can answer ... ?

01 Aug 18 at 12:17


In this video, you mentioned the singular is usually the object in the collection, eg worksheet is an object of the collection of worksheets (plural).

You mentioned usually.

What are the exceptions?



03 Aug 18 at 08:41

The most notable one, I think, is Range.  A range can be a single cell as well as a collection of other cells.

Using the For Each loop to process a range works differently.  In most cases, to process a collection with a For Each loop, you declare a variable whose type is the singular object, e.g. Dim c As Chart.  You then use the plural name of the collection in the loop, e.g. For Each c in Charts.  The relationship holds true for most examples - Worksheet:Worksheets, Workbook:Workbooks, Shape:Shapes, PivotTable:PivotTables, etc.

To process a range with a For Each loop, you would use the singular object to declare the variable, e.g. Dim r As Range.  You would not, however, use Ranges as the name of the collection.  Instead, you must specify the range of cells you wish to loop over.  This provides a large amount of flexibility, as many properties and methods return a reference to a range object.  Any of the examples below are valid:

For Each r In Range("A1:A10")

For Each r In Range("A1").CurrentRegion

For Each r In ActiveSheet.Cells

For Each r In Selection


04 Aug 18 at 15:25

One thing I noticed from watching your collections video is this.  Normally to loop over a collection, you define a variable of the same type as the collection.  For example:

Dim ws as Worksheet
For Each ws In ThisWorkbook.Worksheets

Next ws

So assuming that's a "rule" I tried this, which obviously failed:

Dim MyColl As Collection
Dim MyCollElement As Collection

For Each MyCollElement In MyColl

Next MyCollElement

thinkg that since I'm looping over a collection (MyColl), I must define a variable of the same type, MyCollElement, as a Collection too!

04 Aug 18 at 15:21

Thanks for the examples.

07 Jun 18 at 01:04

Hi, I have created a custom ribbon and attached a macro to this item in excel. My question is how do I make this custom ribbon/button available on each end user's terminal? The macro-enabled document is located on a shared folder through which all users have equal access. However, the custom ribbon/button is not available to all users when opening the same workbook.

Can you kindly help or instruct accordingly please?

07 Jun 18 at 07:21

Hi, you can share your custom ribbon configuration with other users as described here.

I hope that helps!


07 Jun 18 at 15:03

Thanks for the quick response. 

I am aware of the importation method but I was wondering if there was anything more versatile and dynamic. The end product would target many users on various terminals and it would be inefficient to have everyone import custom tools everytime a change, improvement or alteration is made .

Is it possible to have implicitly included in the code the ability to have real time updates for the custom toolbar or ribbon?

Thanks a lot for your help. 

Andrew G  
08 Jun 18 at 07:42

Hi,  I think that the bottom answer on this page may help!

16 Nov 17 at 16:38

Hai Andrew G,

I just want to encrypt my VBA code. Apart from using password protection from tools menu, Is there any possible way to do that? If the user tries to open tne module then the code should be at an encrypted state. I do not think, using password is an effective way to protect my code because there is a way to break the password and to view the code.

16 Nov 17 at 19:14

Hi Abishek, there are commercial tools available such as and

I haven't used either of them so can't comment on their effectiveness.

I hope that helps!

17 Nov 17 at 02:13

Thanks Andrew G

I will try those...

15 Nov 17 at 10:26

Hai Andrew G,

Thankyou so much for your help. Is there any alternative ways to use firefox as a web browser in Excel VBA instead of IE. If any tutorial available for this case, kindly give me that link.

15 Nov 17 at 10:36

Hi Abishek, other than Selenium there's a commercial tool available here but I haven't used it so don't know how useful it will be!

15 Nov 17 at 13:45

Hi Andrew G, thank you so much. 

14 Nov 17 at 09:07

Hai Andrew G,

Firstly, I would like to thankyou for this woderfull playlist of ExcelVBA. I have a request for you. Is it possible to view the progress status of the ongoing Macro through a status window. It should show the status as percentage.


14 Nov 17 at 10:42

Hi Abishek,

The VBE doesn't have a feature like the one you've described.  You could create your own progress indicator with a User Form and Progress Bar as shown in this video

I hope that helps!

15 Nov 17 at 03:29

Hai Andrew G,

Thanks Andrew that helps.... Also i have a lot of doubts in using selenium for webpage scraping. Currently i have installed SeleniumBasic- in my Windows 10 device. for example

{sub Frfox()

Dim SLNM As New WebDriver    

SLNM.Start "firefox", ""

end sub}

The above code only opens a new firefox window but the URL is not getting loaded. Please help me with this issue.



Andrew G  
15 Nov 17 at 08:22

Hi Abishek, I'm sorry but I don't have any experience with using Selenium so I can't help you with this.

15 Jun 17 at 01:36


I have gone through your vba videos and they all were awesome. i have one request if you can create one more video that shows dynamic auto filter. .


15 Jun 17 at 07:32

Hi Surjit,

I have a list of videos that I'd love to find the time to make - I'll add this one to it!

11 Mar 17 at 19:55

First of all I would like to congratulate you for this incredible series of videos about VBA.
Through you, I have been able to improve and learn more and more my knowledge in Excel and VBA.
I would like to know if you are going to, or intend to release, any video about Regular Expressions (RegExp) for Excel / VBA?
It is a very interesting and very powerful subject for queries, validations, ect. But little used or demonstrated by the communities.
Again, thank you for the dedication and high quality of your teaching.
A hug from Brazil!

Maux :)

12 Mar 17 at 17:29

That's the second question on Regular Expressions I've had this week! The topic has been on my list for some time, I simply haven't had time to plan and create a video on the subject yet. Perhaps I should move this topic a little further up the list and aim to create something in the near future.

Thank you for the kind comments and for watching!

13 Mar 17 at 15:59

Thank you and congratulations again for the work you have done!

09 Mar 17 at 00:03

I'm developing an Excel VBA program, but I'm having a problem. I need to download a Captcha image from this site

09 Mar 17 at 10:37

I think the answer is to use the URLDownloadToFile function, which you can see our video on here

06 Dec 16 at 13:30

I have a workbook with 4 sheets.  Three of these sheets have employees that are scheduled daily, the fourth is the actual schedule.  What I would like to accomplish is when I schedule that person he or she is highlighted on the other sheets to help identify who we can and cannot use. I am fairly new to VBA, but extremely excited to learn something new.  Thank you so much for you time and any assistance woould be greatly appreciated. 

06 Dec 16 at 18:02

The question is a bit vague, and I suspect this answer won't help much.  What I'd do is follow through the videos or blogs on our website for now. 

However, here's a macro to colour in all the cells in range A1:A3 which contain the name Bill.  You could obviously modify this to work with any range and any name. 

Sub ColourPeople()

    Dim PersonCell As Range
    Dim PersonRange As Range
    'set a variable to refer to the range where people can be found
    Set PersonRange = Range("A1:A3")
    'colour in all the people with the right name
    For Each PersonCell In PersonRange.Cells
        If PersonCell.Value = "Bob" Then
            PersonCell.Interior.Color = vbGreen
        End If
    Next PersonCell
End Sub

Exactly when and how you'd call this macro would depend on exactly what you were trying to achieve.