Microsoft Tools · MIC-72

Basic VBA Macros in Microsoft Excel

Basic VBA Macros in Microsoft Excel is a beginner course in automating Excel with VBA, from recording macros and editing code to variables, conditions, loops, the Excel object model, events and UserForms, through to working with table data and handling errors. It suits data staff and confident Excel users, and you leave able to build a one-click reporting macro.

Updated
From 13,500 THB / person 15,000 −10% excl. VAT 7% · group rates available
PDFDownload the course outline
  • Duration30 hours · 5 days
  • FormatOnsite / live online
  • Next roundOn request
  • CertificateIncluded

Course overview

Many Excel tasks are repeated every day or every month: opening a text file exported from a database system, filling in blank cells, filtering and sorting, copying between files, then summarising with a PivotTable and printing only the records you need. Doing this by hand takes time and steps are easily missed. Macros written in VBA combine these steps so they finish in one click, and VBA remains the main automation tool for Excel on the desktop in Microsoft 365.

This course starts with recording macros, setting macro security and running macros from buttons or shortcut keys. You then read and edit code in the VBA Editor, write subs and functions, use variables, conditions and loops, work with workbooks, worksheets and ranges, write event code, build ways to collect input with MsgBox, InputBox and UserForms, manage data in Excel tables, import and clean CSV data, handle errors and debug code. It finishes with a workshop that builds a one-click reporting system. (5 days, 6 hours per day, 30 hours in total, Beginner level.)

What you’ll gain

  • Record macros, edit the recorded code and choose where to store macros
  • Run macros from buttons, shapes and shortcut keys
  • Set macro security and Trusted Locations correctly
  • Write subs and functions using variables, conditional statements and loops
  • Use the properties and methods of workbooks, worksheets and ranges
  • Write code that responds to workbook and worksheet events
  • Interact with users through MsgBox, InputBox and UserForms
  • Apply VBA to data in Excel tables and CSV files
  • Write error-handling code and debug your code

Who this course is for

  • Data staff who regularly produce reports in Excel
  • IT staff who help users cut repetitive work in Excel
  • Accounting, finance and administrative staff who are confident in Excel and want to start writing macros
  • People who have never programmed but use Excel formulas well

Prerequisites

  • Able to use Data tab commands such as Sort, Filter, Subtotal and Data Validation
  • Understand absolute references ($) and named ranges
  • Able to use Conditional Formatting and PivotTables
  • Able to use IF, XLOOKUP or VLOOKUP, INDEX, MATCH, COUNTIFS and SUMIFS
  • A Windows laptop with Excel from Microsoft 365 or Excel 2024

Curriculum

Course Details

This is the 2026 edition of the Basic VBA macros in Microsoft Excel course. It runs for 5 days, 6 hours per day (30 hours in total, 09:00-16:00), as lectures with hands-on coding labs in every topic, at Beginner level. The content has been updated for Excel in Microsoft 365 and Excel 2024, adding the changed macro security defaults, Trusted Locations, working with Excel

tables and CSV files, and guidance on when Power Query or Office Scripts suit better than VBA. It is an entry-level course, distinct from Excel with VBA and Advanced VBA macros in Microsoft Excel, which go on to more complex work. Learners use their own or their company's Excel for Windows and take home the course handbook, practice files, sample code and the reporting system from the workshop.

Day 1 Getting Started with Macros

Section 1: Macros and VBA in Today's Excel

  • What macros and VBA are, and which jobs they suit
  • The Developer tab and the .xlsm, .xlsb and .xlam file types
  • VBA compared with Power Query and Office Scripts
  • Lab: turn on the Developer tab and save a macro-enabled workbook

Section 2: Lab: Recording Macros

  • Record Macro and naming macros
  • Use Relative References versus absolute references
  • Storing macros in This Workbook or the Personal Macro Workbook
  • Lab: record a macro that formats a daily report

Section 3: Lab: Macro Security

  • The Trust Center and macro settings
  • Macros in files from the internet are blocked by default
  • Trusted Locations and an overview of digital signatures
  • Lab: set your work folder as a trusted location

Section 4: Lab: Running Macros

  • Running from the Macros dialog and with shortcut keys
  • Assigning macros to form control buttons and shapes
  • Adding macros to the Quick Access Toolbar and the ribbon
  • Lab: build a menu sheet with buttons for several macros
Day 2 VBA Language Basics

Section 5: Lab: The VBA Editor and Recorded Code

  • The Project Explorer, Properties window and code window
  • Reading recorded code and removing unnecessary lines
  • Comments, indenting code and stepping through line by line
  • Lab: tidy a recorded macro so it is shorter and faster

Section 6: Lab: Modules, Subs and Functions

  • Module structure and naming subs
  • Passing arguments and calling one sub from another
  • Functions used as worksheet formulas (UDFs)
  • Lab: write a function that calculates commission by rule

Section 7: Lab: Variables and Data Types

  • Dim, common data types and Option Explicit
  • Constants (Const) and variable scope
  • Working with text, numbers and dates
  • Lab: read cell values into variables and calculate

Section 8: Lab: Conditional Statements

  • If...Then...Else and ElseIf
  • Select Case for many conditions
  • The And, Or and Not operators and comparing text
  • Lab: grade customers and highlight unusual records
Day 3 Loops and the Excel Object Model

Section 9: Lab: Loops

  • For...Next and Step
  • For Each over cells and worksheets
  • Do While and Do Until, and exiting a loop
  • Lab: loop through exported data and fill in blank cells

Section 10: Lab: The Excel Object Model

  • Application, Workbook, Worksheet and Range
  • Referring with Range, Cells and Offset
  • With...End With and object variables
  • Lab: refer to data across sheets without selecting

Section 11: Lab: Range Properties and Methods

  • Value, Formula, NumberFormat and Font
  • Finding the data area with CurrentRegion and End(xlUp)
  • Copy, ClearContents, Sort and AutoFilter in code
  • Lab: filter records by condition and copy them to a report sheet

Section 12: Lab: Managing Sheets and Multiple Files

  • Adding, deleting, renaming and looping through sheets
  • Opening, saving and closing workbooks in code
  • Looping through every file in a folder with Dir
  • Lab: combine data from several branches into one workbook
Day 4 Events, User Interaction and Table Data

Section 13: Lab: Workbook and Worksheet Events

  • Workbook_Open and Workbook_BeforeSave
  • Worksheet_Change with Intersect to limit the range
  • Application.EnableEvents and preventing repeated triggering
  • Lab: stamp the date and time automatically when a status changes

Section 14: Lab: MsgBox and InputBox

  • MsgBox with buttons and reading the user's choice
  • InputBox and Application.InputBox for selecting a range
  • Checking user input before processing
  • Lab: ask for a month and build that month's report

Section 15: Lab: UserForm Basics

  • Creating a UserForm and placing controls
  • TextBox, ComboBox, OptionButton and CommandButton
  • Loading items into a ComboBox and writing values to the sheet
  • Lab: a supplies request entry form

Section 16: Lab: VBA with Excel Tables

  • ListObject, ListRows and ListColumns
  • Adding new rows and finding, editing and deleting records
  • Filtering, sorting and refreshing PivotTables in code
  • Lab: connect the supplies form to an Excel table
Day 5 System Data, Robust Code and Workshop

Section 17: Lab: Importing and Cleaning CSV Data

  • Opening CSV files and UTF-8 Thai text
  • Trimming spaces, splitting text and converting text to numbers or dates
  • Exporting results to CSV or PDF
  • Lab: prepare a system export ready for summarising

Section 18: Lab: Handling Errors

  • On Error GoTo, Resume and the Err object
  • Checking files, sheets and data before processing
  • ScreenUpdating and Calculation for speed
  • Lab: make the file-combining macro carry on past a malformed file

Section 19: Lab: Debugging Code

  • Breakpoints, Step Into and Step Over
  • The Immediate window, Debug.Print and the Locals window
  • The Watch window and tracking down wrong values
  • Lab: fix the bugs hidden in a sample macro

Section 20: Workshop: A One-Click Reporting System

  • Workshop: import, clean and combine several files
  • Summarise with a PivotTable and print only matching records
  • A menu sheet, buttons and a UserForm for users
  • A checklist before sharing a macro workbook, and next steps

Schedule & training options

For individuals — public rounds

No public rounds are open right now. Join the waiting list and we will contact you first when the next round opens, or ask us on LINE. Or call 02-570-8449 or 088-807-9770

For organisations — in-house / private

  • Tailor the content to your team’s tools and projects
  • Your dates, at your office or live online
  • Quotation with tax ID for procurement
Corporate training quote

Instructors

Frequently asked questions

How do you record a macro in Excel and then edit the VBA code?

On the Developer tab, click Record Macro, give it a name and choose where to store it, carry out the steps, then click Stop Recording. Press Alt+F11 to open the VBA Editor, where the code sits in a module of that workbook and can be edited straight away, for example by removing unnecessary Select statements or replacing fixed ranges with code that finds the data area. Save the file as .xlsm to keep the macro.

How do you use If and For Each in VBA?

If checks a condition and chooses what to do, for example colouring sales green when they beat the target. For Each repeats an action for every member of a collection, such as every cell in a range or every sheet in a workbook. Together they let you check data cell by cell and act only on the cells that match. Declare variables with Dim and use Option Explicit to reduce mistakes.

How do you set macro security in Excel?

Go to File, Options, Trust Center and Trust Center Settings. The recommended setting is to disable macros with notification, then add the folders that hold your work macro files as Trusted Locations. Macros in files downloaded from the internet or received by email are blocked by default, so enable only files from sources you trust. In organisations, administrators may already control these settings.

Who is the Basic VBA Macros in Microsoft Excel course for, and what should I know beforehand?

It suits data staff, IT staff and employees who are confident in Excel and want to cut repetitive work. You do not need programming experience, but you should be able to use Data tab commands, Conditional Formatting, PivotTables and formulas such as IF, XLOOKUP, COUNTIFS and SUMIFS, and bring a Windows laptop with Excel from Microsoft 365 or Excel 2024.

What will I be able to do after the Basic VBA Macros in Microsoft Excel course?

You will be able to record and edit macros, set macro security, write subs and functions with variables, conditions and loops, control workbooks, worksheets and ranges in code, write event code, build UserForms, manage data in Excel tables and CSV files, handle errors and build a one-click reporting system. Participants who complete the training receive a Certificate of Completion with its own number, which can be verified online.

Can the Basic VBA Macros in Microsoft Excel course be run in-house for our team?

Yes. It can be run in-house for your team, with examples adapted to your own work, such as your system exports, monthly reports or the forms you actually use. You can request a quotation from this page, or contact us on LINE @itgenius or by phone on 02-570-8449.

Related articles

Articles are published in Thai.