The Complete Excel Course with AI Integration
Excel macros and VBA for payroll administrators
Before every pay run someone scans thousands of lines for a blank cost centre, a missing employee ID or a word where hours belong, then formats the file as last time. The Complete Excel Course with AI Integration hands that routine to Excel macros and VBA on FormatWizard, an industry-standard project, and this page picks out the lessons that build it: recording, the VBA editor, loops that flag and colour each fault, Debug.Print and one master macro.
Taught by Sagnik Bhattacharya and Virginia Thorn
What you will be able to do
At work, you will be able to:
- Record a macro that formats each period's pay file the same way, run it from a button on the Quick Access Toolbar and keep it in a macro-enabled workbook.
- Find the last line of a register whose length changes with joiners and leavers, using a VBA function instead of a fixed row number.
- Flag every pay line with a missing employee ID, department or cost centre with a For Next loop, and colour each gap with RGB.
- Mark hours, rates and amounts that hold a word, a note or a stray character with IsNumeric before they reach a total.
- Clear last run's flags and run every check in order from one master macro protected by an error handler.
- Test a payroll macro on a copy with Debug.Print and the Immediate window before it writes a single flag on live data.
- Read, correct and extend VBA drafted by ChatGPT or Claude, or inherited from a predecessor, with Option Explicit catching mistyped variables.
Projects
What you will build.
The course has 14 industry-standard projects. These three matter most here.
-
Project 11
FormatWizard
One click that checks a whole sheet for you.
Built to validate a sales sheet thousands of rows long, it hands a payroll administrator the full anatomy of a pre-run check: a function that finds the last line, a reset of the previous run's marks, flags written and coloured line by line, and one master macro calling each check in turn. Rename the columns and it reads a pay register.
-
Project 13
AutoFlow
The weekly report routine, run by a flow instead of by you.
Built around a weekly sales report, it shows the other road payroll automation can take: Power Automate Desktop, on Windows, opens the workbook, reads its rows, marks each one that meets a condition and saves, with the logic laid out visually for anyone to audit. Set beside FormatWizard, it makes the choice between code and a flow a practical one.
-
Project 14
Agentic AI in Excel
AI finds and fixes the formula; you check it before it counts.
Built to put Copilot, ChatGPT and Claude to work on real spreadsheet tasks, it trains the habit a payroll macro needs most: the AI writes a first draft, and you read and test it before it goes anywhere near the pay file.
Lessons
The lessons that matter, in course order.
The Complete Excel Course with AI Integration has 186 lessons. This page picks out 17 of them, 1 h 16 min of video. Each lesson keeps its number in the course.
Where to start
Lesson 136 Excel macros and VBA for beginners
Start at Lesson 136: the macro lessons assume no code at all, so a payroll administrator who can open, edit and save a workbook follows them from the first recording. Excel itself still new? Begin at Lesson 1 and pick up the pay-rule formulas from Lesson 28 on the way. Already recording macros? Jump to Lesson 141, where the VBA editor opens and the code is written by hand.
17 of 186 lessons · 1 h 16 min
14 VBA and macros in Excel: FormatWizard Recording first: what a macro and VBA are, a first recording of a row's formatting with absolute and then relative references, a Developer tab with a button and a place on the Quick Access Toolbar, and the macro-enabled file that keeps the code. For a payroll office that is the period's routine formatting of a pay file, done with one keystroke from whichever row needs it.
- 136 Start here Excel macros and VBA for beginners What macros are, the FormatWizard project 3 min
- 137 Record your first Excel macro Name, run and use absolute references 6 min
- 138 Relative references in Excel macros Make recorded macros dynamic 4 min
- 139 Developer Tab in Excel Run macros from a button and the quick access toolbar 4 min
- 140 Save macros in Excel Macro-enabled workbooks and the XLSM file format 3 min
14 VBA and macros in Excel: FormatWizard Into the editor: the VBA editor and its modules, macro security and the Enable Content bar, a first line of code that points at a named sheet, variables under Option Explicit, the difference between a Sub and a Function, and GetLastUsedRow, which finds where the data ends however many joiners or leavers changed the register's length.
- 141 The VBA Editor in Excel Open it with Alt+F11 and learn the workspace 4 min
- 142 Working in the VBA editor Macro security, trust settings, switching to Excel 6 min
- 143 Your first VBA code Modules, worksheets, rows, columns and formatting 4 min
- 144 VBA variables and data types Sub vs function for Excel beginners 6 min
- 145 VBA functions in Excel Build GetLastUsedRow with find and exit function 5 min
14 VBA and macros in Excel: FormatWizard The checks themselves: a routine that clears the last run's flags and fills, a For Next loop that writes a flag beside every row with a missing value, an If and Else that builds one message from several checks, light red fills set with RGB, and IsNumeric, which marks a word, a note or a stray character sitting in a number column. On a pay file the columns become employee ID, cost centre, hours and amounts.
- 146 Clear old flags with VBA Reset messages and fill colours with if statements 5 min
- 147 For Next loop in VBA Flag missing region values in Excel 4 min
- 148 VBA If Else and loops Check missing sales data and build a FlagText message 5 min
- 149 Highlight cells with VBA Interior.Color and RGB for missing data 5 min
- 150 IsNumeric in VBA Validate unit price and amount data types in Excel 7 min
14 VBA and macros in Excel: FormatWizard Proof and the finished tool: Debug.Print and the Immediate window to watch what the code reads before it writes a single flag, then one master macro that runs every check in order behind an error handler, with screen updating off so a long register is read quickly.
- 151 Debugging VBA for beginners Debug.Print and the Immediate window 5 min
- 152 Complete Excel validation macro One VBA subroutine with an error handler 3 min
Instructors
Who teaches it.
Instructor, Excel with AI
Virginia Thorn
Emmy Award winner. Teaches Excel with AI at Coding Liquids.
Questions
Asked before starting.
Excel macros and VBA for payroll administrators: can a macro I write myself be trusted with the pay file, and where is that taught?
Yes: the macro The Complete Excel Course with AI Integration from Coding Liquids teaches you to build reads the pay file and changes no figure in it, so trust rests on something you can see. FormatWizard, an industry-standard project designed after talking with people from many different industries, writes a plain message beside each faulty line and colours the cell, leaving every correction to you before cut-off. The 17 lessons picked out here, 1 hour 16 minutes in all, take a payroll administrator from a first recorded macro to code read line by line in the editor, tested with Debug.Print before it writes anything, and wrapped in an error handler that reports a problem instead of stopping halfway. Built on a sales sheet, the check reads a register once its columns say employee ID, cost centre, hours and amount.
Which pay-run chores should a payroll administrator hand to a macro first?
The checks you repeat before every run, then the formatting, and The Complete Excel Course with AI Integration teaches both. Most payroll errors begin as a blank cost centre, a missing employee ID or a word typed where hours belong, and scanning thousands of lines for them by eye is slow and unreliable. FormatWizard's loops find every such line, flag it and colour it (Lesson 147 to Lesson 150), and the master macro runs the lot from one button (Lesson 152). Recorded macros then take over the formatting each period's file needs (Lesson 137). Building payslips or a bank upload file is outside the lessons, and the run itself stays in your payroll system; what you gain is the habit of handing repetitive checking to code and spending your own time on the exceptions it finds.
Can a recorded macro format each period's pay file the same way every time?
Yes, and recording is how The Complete Excel Course with AI Integration opens the macro lessons, with no code typed. In Lesson 137 you record a macro that formats a row holding a negative amount, bold, italic and highlighted, then run it from the Macros list and from a shortcut key. Lesson 138 records it again with relative references, so one keystroke formats whichever row the cursor sits on, and Lesson 139 puts it on the Developer tab and the Quick Access Toolbar as a button. In a pay file the negative row is a reversal or a recovered overpayment, worth marking before anyone signs off. Lesson 140 saves the workbook as a macro-enabled file, since an ordinary workbook drops the code. One caution from the lessons: Ctrl+Z cannot undo a macro, so try it on a copy first.
Joiners and leavers change the length of the register every period: how does the macro know where the data ends?
It asks the sheet, with a function The Complete Excel Course with AI Integration builds for exactly this. GetLastUsedRow, written in Lesson 145, first checks with COUNTA that the sheet is not empty, then searches upwards from the bottom for the last cell holding anything and hands back its row. Run on the project's data it reports the last row; paste in one more line and it reports the next, with no row number typed into the code. Every check after it loops from the first data row to that answer, so a register that gained a dozen joiners or lost a handful of leavers is read to its true end each time. Lesson 144 explains why it is a Function rather than a Sub: it returns a result any later macro can reuse, and Option Explicit catches a mistyped variable before it misleads you.
Can the macro flag every line with no employee ID, department or cost centre?
Yes: that is the loop at the heart of FormatWizard in The Complete Excel Course with AI Integration. Lesson 147 walks down the sheet with a For Next loop and writes a message beside every row whose region is empty, trimming the cell first so a cell of spaces counts as empty too. Lesson 148 tests two columns in one pass and builds a single message per row, so a line missing both items says so in one flag, and Lesson 149 colours each empty cell light red with RGB. Swap region and salesperson for employee ID, department or cost centre and the same loop reads your register. The flags sit in a column of their own, so you can filter the pay file to the flagged lines and clear them before the cut-off.
Hours entered as a word, or a note such as N/A in an amount column: will the macro catch them?
Yes: Lesson 150 of The Complete Excel Course with AI Integration adds that check with IsNumeric, the VBA test of whether an entry can be treated as a number. Timesheets keyed by managers are where such entries come from: eight typed out in letters, N/A for someone on leave, a letter O where a zero belongs. The macro tests each line of the hours, rate or pay column, and wherever the test fails it colours the entry and its flag light red and records it as invalid, so the line is put right before gross pay is worked out. Digits held as text are a separate fault with their own cure in the course: COUNT beside COUNTA exposes them on the worksheet (Lesson 35), and Power Query sets true data types (Lesson 158).
The check from last period left its flags behind: will this run start from a clean sheet?
Yes: The Complete Excel Course with AI Integration builds a reset that runs before every check. Lesson 146 clears the flag column's messages and fill colours from the first data row to the last, reports that it is done, and stops with a warning when the sheet holds nothing but headers. That matters in payroll, where a file is often checked, corrected and checked again just before cut-off: without the reset, a flag from the first pass would sit beside a line already put right, and nobody could tell an old problem from a new one. The colours left on the data cells come off with Clear Formats, as Lesson 149 shows. In the finished tool the reset is the first call of the master macro (Lesson 152), so every run's messages describe the file as it stands now.
Can one button run every check before I approve the pay file?
Yes: Lesson 152 of The Complete Excel Course with AI Integration closes FormatWizard with RunFullValidation, a master routine that calls the reset, the blank-field checks and the number test in turn, so approval starts from a full report on the register. It turns screen updating off while it works, which spares you the flicker and the wait on a long file, and turns it on again at the end. Should a routine fail midway, the error handler takes over, puts the screen back and names the fault in a message, so you never approve a file the check only half read. The lesson also cures a quiet bug: two routines writing into one flag cell must append after a separator, or the later message erases the earlier. Pinned to the Quick Access Toolbar (Lesson 139), the pre-approval check sits a press away.
How do I test a payroll macro before it touches a live pay file?
The way The Complete Excel Course with AI Integration tests its own: with planted faults, watching what the code reads. The lessons clear a region or a salesperson on purpose and confirm that exactly those rows come back flagged (Lesson 147, Lesson 148); do the same with a blank cost centre and a word in the hours column of a copy of last period's file. Lesson 151 adds Debug.Print and the Immediate window, which show what the loop reads, row by row, without writing anything to the sheet, so a check aimed at the wrong column is caught before it marks hundreds of lines. Work on a copy throughout, since a macro's changes cannot be undone with Ctrl+Z, and keep the original pay file untouched until the check runs clean.
When I am on leave, can my deputy run the same checks from the same workbook?
Yes, and consistency is the reason The Complete Excel Course with AI Integration gives for macros in the first place: a macro runs the same way every time, for you or for a colleague (Lesson 136). Saved as a macro-enabled workbook (Lesson 140), the code travels inside the file, so your deputy opens it, clicks Enable Content on the yellow bar, which Lesson 142 explains along with when to trust a file, and presses the same button. The messages the checks write are plain words beside each line, so nobody needs to read the code to act on them. Keep the workbook in a fixed place on the shared drive and cover during leave becomes a click rather than a handover note. The code runs in desktop Excel, the Excel the course is taught in, and not in a browser.
If ChatGPT drafts the loop that checks our pay file, what must I understand before running it?
Enough to read it line by line, and The Complete Excel Course with AI Integration gets you there. In Lesson 148 the learners write parts of the macro with Claude or ChatGPT, each in its own window, and then correct what comes back, which is the honest picture of AI and VBA: a fast first draft that needs a reader. The lessons before it supply that reader's knowledge: what Set, Dim and a loop counter do (Lesson 143 to Lesson 147), why Option Explicit stops a mistyped variable (Lesson 144), and how Debug.Print shows what the code really reads (Lesson 151). For a pay file the questions to ask of any draft never change: which sheet, which columns, which rows, and what it writes. Enable Content only for code you have read.
Payroll teams hear that macros are old technology: is VBA still worth learning, or is something replacing it?
Worth learning, and The Complete Excel Course with AI Integration teaches it beside the tool most often named as its successor, so the choice is yours for each job. VBA lives inside the desktop Excel your pay file already opens in, needs nothing installed, and runs a long list of rows faster than a flow usually does, as Lesson 185 itself points out. Power Automate Desktop, on Windows, records a visual flow you can inspect and share without code (Lesson 181), which suits a routine that crosses several programs. AI drafts VBA quickly, and a reader who understands loops, flags and error handlers still decides whether it runs on payroll data. A payroll workbook inherited from a predecessor often carries macros already; knowing VBA means you can read, fix and extend them instead of working around them.
Can a macro flag the employees whose pay changed sharply since last period?
Yes, by joining two things The Complete Excel Course with AI Integration teaches: a change column on the sheet and an If test in the loop. The comparison itself is formula work: XLOOKUP brings last period's figure beside this one for each employee (Lesson 69) and a subtraction gives the change. The macro then reads that column line by line, as FormatWizard's loops read theirs (Lesson 147), and an If that compares a number with a limit, the kind Lesson 146 uses to stop on an empty sheet, flags and colours every line where the change passes your threshold. The lessons' own checks look for blanks and non-numbers; this one reuses the same loop, If and colour with a comparison of your choosing, and joins the master macro's run before sign-off.
Do I need to be strong on formulas before the VBA lessons make sense?
The basics are enough, which makes these lessons a quick win for a busy payroll office. The Complete Excel Course with AI Integration begins at Lesson 136 with what a macro is, records before it codes, and introduces each VBA idea on one sales sheet in a sensible order: a sheet held in a variable, a counter, an If, a loop, a function, then an error handler. Nothing in them leans on SUMIFS or lookups. Your formula skills matter for the pay rules themselves, which the formula lessons from Lesson 28 cover, and they make extra checks, such as a change column for the macro to read, easy to set up. Taken straight through, the macro path is 1 hour 16 minutes, short enough to finish between two pay runs, with the finished workbook beside you to compare against.
Excel with AI
See the whole course.
The Complete Excel Course with AI Integration: 16 hours of video in 186 lessons, built around 14 industry-standard projects, with lifetime access, a Certificate of Completion and a 14-day money-back guarantee.
The same course
For another job, skill, goal, level, topic or comparison.
The course for this job
The course for this skill
More skills for this job
- Formulas for payroll administrators
- Lookups for payroll administrators
- PivotTables for payroll administrators
- Charts for payroll administrators
- Dashboards for payroll administrators
- Conditional formatting for payroll
- Data cleaning for payroll administrators
- Data validation for payroll admins
- Excel tables for payroll administrators
- Text functions for payroll admins
- Power Pivot and DAX for payroll admins
- Power Automate for payroll admins
- Claude in Excel for payroll admins