Learn Excel VBA: write macros that do your work for you

A learning path from your first macro to reports across several sheets. You write every macro yourself, run it in your browser and see right away what it changed on the sheet. No Excel install needed, level 1 is free.

Try it right now

This is what an exercise looks like: the sheet at the top, the VBA code below. Write the missing line, then Run (F5) shows the sheet after the macro, and Check also tests it on different data.

How it works: a macro sits between Sub Name() and End Sub, with the commands in between. This line puts the contents of A1 into C1: Range("C1").Value = Range("A1").Value. The target goes left of the =, the source on the right. The task needs exactly one line like that, just with other cells.

Task Write a macro CopyValue that copies the contents of A2 to B2. Check also tests it with different text in A2.

ABCD
1OriginalCopy
2Invoice 1043
3
4
5

Done? Then you just wrote your first macro. How a macro is built and where it goes in real Excel is covered in the first lesson.

Start with lesson 1 Create a free account

What you learn in this course

VBA (Visual Basic for Applications) is the programming language built into Excel. You use it to write macros: small programs that enter values, calculate, format, sort and add sheets, faster than by hand and the same way every time. The course has six levels, each ending with a project from everyday office work.

  • Level 1: First macros. Editor and modules, recording a macro and cleaning it up, Range and Cells, variables and data types, MsgBox and InputBox, calculations and joining text, If Then Else. Project: fill in an invoice.
  • Level 2: Loops and ranges. For Next, finding the last row, For Each, Do While, Select Case, Offset and Resize. Project: commission list.
  • Level 3: Sheets, formats and functions. Addressing and adding worksheets, formatting, worksheet functions such as VLOOKUP in VBA, string and date functions, your own functions. Project: monthly report.
  • Level 4: Processing data. Copy and paste, deleting rows, sorting and removing duplicates, searching with Find, writing formulas from a macro, With and faster macros. Project: clean up data.
  • Level 5: Advanced. Arrays, Dictionary and Collection, error handling, procedures with arguments, debugging and events such as Worksheet_Change. Project: customer report.
  • Level 6: Real work and final test. Combining sheets, building reports with a macro, enabling macros and saving safely. Then the final project and the final test with a certificate.

The learning path

The lessons build on each other, but you can open any of them directly. With a free account, your solved exercises are saved. The full overview with projects and the final test is on the VBA course page.

  1. Level 1: First macros

    1. Basics: editor, module, first macro 3 exercises
    2. Record a macro and clean it up 2 exercises
    3. Range and Cells 3 exercises
    4. Variables and data types 3 exercises
    5. MsgBox and InputBox 3 exercises
    6. Calculations and joining text 3 exercises
    7. If Then Else 3 exercises
    8. Project: fill in an invoice 3 exercises
  2. Level 2: Loops and ranges

    1. For Next loop 3 exercises
    2. Find the last row 3 exercises
    3. For Each 3 exercises
    4. Do While and Do Until 3 exercises
    5. Select Case 3 exercises
    6. Offset and Resize 3 exercises
    7. Project: commission list 3 exercises
  3. Level 3: Sheets, formats and functions

    1. Working with worksheets 3 exercises
    2. Formatting cells 3 exercises
    3. Worksheet functions in VBA 3 exercises
    4. String functions 3 exercises
    5. Dates and times 3 exercises
    6. User-defined functions 3 exercises
    7. Project: monthly report 3 exercises
  4. Level 4: Processing data

    1. Copy and paste 3 exercises
    2. Delete and insert rows 3 exercises
    3. Sort and remove duplicates 3 exercises
    4. Searching with Find 3 exercises
    5. Writing formulas with VBA 3 exercises
    6. With and faster macros 3 exercises
    7. Project: clean up data 3 exercises
  5. Level 5: Advanced

    1. Arrays 3 exercises
    2. Dictionary and Collection 3 exercises
    3. Error handling 3 exercises
    4. Procedures with arguments 3 exercises
    5. Debugging 3 exercises
    6. Events (Worksheet_Change) 2 exercises
    7. Project: customer report 3 exercises
  6. Level 6: Real work and final test

    1. Combine sheets 3 exercises
    2. Create a report with a macro 3 exercises
    3. Enable macros and save safely 3 exercises
    4. Final project 3 exercises
    5. VBA final testcertificate after levels 1 to 5

How practicing in the browser works

Excel for the web cannot run macros. So your code runs on our server in a re-creation of VBA with a worksheet. You see the sheet before and after, changed cells are highlighted, MsgBox shows up as a message box and Debug.Print in the Immediate window. With Step through (F8) you go through the macro line by line and watch the variables, just like the Locals window in the VBA editor.

Check compares the sheet after your macro with the expected result, then runs your macro again on other, hidden data: more rows, different values. A loop that stops at a fixed row, or a result typed in by hand, gets caught. Errors use the same wording as the VBA editor, such as "Run-time error '13': Type mismatch", with a hint about the usual cause, and the line is highlighted.

To experiment freely, use the VBA online editor with sample data, no task and no account needed.

Who the course is for

  • Excel users in the office: you repeat the same steps every week, such as cleaning up an export or creating a report per department, and want a macro to take over.
  • Finance, accounting, sales: you work with long lists and need reports that rebuild with one click.
  • New to programming: VBA is the first programming language for many people. Variables, loops and conditions work the same way in other languages.
  • Job applications: the job ad asks for VBA skills and you want to list them honestly. The final test with certificate shows that you can write macros yourself. To prepare, there is the VBA assessment test, common VBA interview questions and a comparison of credentials on VBA certification.
  • Teams: companies, schools and public bodies can buy team seats.

Basic Excel skills help: cell references, simple formulas, sorting and filtering. If you are not confident with those yet, start with the Excel course.

What is free and what Premium costs

Every lesson is free to read. Level 1 with all its exercises and the project is free. From level 2, the first exercise of each lesson is free; the other exercises and the projects are part of Premium. Premium covers every subject on LearnThisNext, today Excel, SQL, VBA and Power BI. The price is on the pricing page.

FAQ

Do I need Excel to learn VBA?

Not for the course: every exercise runs in the browser, on Mac, tablet and phone too. For your own macros you need Excel for Windows or Mac. Excel for the web does not run VBA macros. What is different on a Mac is covered in VBA on Mac.

How long does it take to learn VBA?

That depends on how much time you put in. With level 1 you write simple macros that fill cells and calculate. Level 2 adds loops, and with those you can already automate a lot of routine work. Practicing regularly matters more than long sessions.

Is VBA still worth learning?

For Excel on Windows and Mac, VBA is the macro language, and many companies use workbooks with macros. Excel for the web has a different language, Office Scripts. The core ideas, variables, loops, conditions and the object model of sheets and cells, help you there too. Which tool fits when is in the comparison VBA vs Python, Office Scripts and Power Automate.

Can I record a macro instead of writing it?

Yes, and that is a good start. The recorder writes down what you click. It cannot do loops or conditions, though, and recorded code contains a lot of clutter. How to clean it up is shown in Record a macro. What macros are and how to run them is in the overview Excel macros.

Where can I find exercises, examples and a list of commands?

All loops compared are on VBA loops. Every exercise by level and topic is on VBA exercises, the six level projects on VBA projects. Ready-made macros for common office jobs are on VBA macro examples, every command at a glance on VBA commands. The free VBA test shows where you stand.

Is there a certificate?

Yes. Once you have solved every lesson in levels 1 to 5, you can take the final test: hands-on tasks against the clock. Pass it and you get a LearnThisNext certificate with a verification link. It is not a Microsoft certification.

Write to us

Choose language

Select your preferred language