The Complete Excel Course with AI Integration
Excel macros and VBA for health and safety officers
Before every monthly report someone scrolls the incident log for missing sites, blank owners and lost days typed as words, then fixes them by eye. The Complete Excel Course with AI Integration turns that routine into a macro on FormatWizard, an industry-standard project in its own right, and the lessons below follow the build: the recorder, buttons and safe macro files, then VBA that loops through every row, flags and colours each fault and reports in one click.
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 an incident row in one keystroke, using relative references so it works on whichever row is selected, and start it from a button or from the Quick Access Toolbar.
- Save the incident log as a macro-enabled .xlsm workbook and handle the macro security bar, so trusted code runs and unknown code stays off.
- Write VBA in the editor with Option Explicit, declared variables and a reusable function that locates the final row of a log that grows every week.
- Loop through every row with For Next and If Else, writing a flag such as a missing site into a column of its own and joining several faults in one cell.
- Colour each cell at fault with Interior.Color and RGB, so a supervisor sees the gaps in the log at a glance.
- Flag lost days or hours worked that hold a word, a note or a stray character in place of a number, using IsNumeric.
- Check what the code reads by printing it to the Immediate window with Debug.Print, before it writes a single flag.
- Gather every check into one master macro with an error handler, so the weekly audit of the log runs in a single click and reports any problem in plain words.
Projects
What you will build.
The course has 14 industry-standard projects. These two matter most here.
-
Project 11
FormatWizard
One click that checks a whole sheet for you.
Built to audit a long sheet of sales rows, FormatWizard hands you the pattern of a weekly incident log check: blanks flagged in a column of their own, cells at fault coloured light red, entries that are not numbers caught, and one master routine with an error handler.
-
Project 13
AutoFlow
The weekly report routine, run by a flow instead of by you.
Built for a weekly sales report, AutoFlow shows the code-free route beside VBA: a Power Automate Desktop flow that opens a workbook, reads rows, writes a result and closes it again, for routines that reach beyond one sheet.
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
Begin at Lesson 136 if your incident log lives in Excel and you write the odd formula: the section assumes no programming at all and records a macro before any code is typed. If Excel itself is new, start at Lesson 1: by the time FormatWizard arrives, IF formulas feel familiar, and an If statement in VBA reads the same way. Comfortable with the recorder already? Hand-written VBA begins at Lesson 143, and the checks on the data at Lesson 146.
17 of 186 lessons · 1 h 16 min
14 VBA and macros in Excel: FormatWizard The recorder first, after a short tour of the sheet FormatWizard will audit: a first macro named, given a shortcut and replayed, recorded with fixed references and then with relative ones, so one keystroke formats whichever row of a log you stand on.
- 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
14 VBA and macros in Excel: FormatWizard Macros within reach and kept safe: the Developer tab, a button and the Quick Access Toolbar, the .xlsm format that keeps code with the data, the VBA editor opened with Alt+F11, and macro security, so code runs only in files you have chosen to trust.
- 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
- 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
14 VBA and macros in Excel: FormatWizard Code typed by hand: a module that points at the worksheet by name, Option Explicit and declared variables, a Sub set beside a Function, and GetLastUsedRow, which locates the final filled row so a check always reaches the newest entry.
- 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, on a sales sheet whose region and salesperson columns stand in for your site and action owner: last run's flags and fills wiped, a For Next loop that notes every blank, a second test in the same loop with all of a row's problems collected in one cell, and soft red fills marking exactly where each gap sits.
- 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
14 VBA and macros in Excel: FormatWizard The last mile: IsNumeric flags a number column holding a word or a stray character, Debug.Print lists in the Immediate window what the code reads, and one master macro with an error handler calls every check in turn.
- 150 IsNumeric in VBA Validate unit price and amount data types in Excel 7 min
- 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.
Between site visits and audits, can a health and safety officer learn Excel macros and VBA online and come away with a working check on the incident log?
Yes: The Complete Excel Course with AI Integration from Coding Liquids teaches it in short lessons that fit between site visits, on FormatWizard, an industry-standard project designed after talking with people from many different industries, and the routine it automates is the one a safety officer repeats before every report: reading a long sheet row by row for gaps and bad entries. You start with the macro recorder, which writes the code while you work, and a button to run it; typed VBA follows one idea at a time: finding where the data ends, flagging every blank in a column of its own, catching entries that are not numbers, colouring each cell at fault and running it all from one master macro. The 17 lessons listed here build it in 1 hour 16 minutes, a few minutes at a sitting. The practice sheet holds sales rows; your incident log's site, owner and lost-days columns take the place of its region, salesperson and per-unit figure with no change to the logic.
Which checks on the incident log can a macro run before the monthly report goes out?
Three kinds, and The Complete Excel Course with AI Integration builds each one into FormatWizard. Blanks first: Lesson 147 loops down every row and writes a message beside any row with an empty region, using Trim so a cell holding only spaces still counts as empty, and Lesson 148 adds a second check to the same loop. Point those at your site, injury type or action owner columns. Then entries that should be numbers: Lesson 150 uses IsNumeric to flag a number column holding a word, a note such as N/A or a stray character, which is what happens to lost days and hours on a hurried form. Finally colour: Lesson 149 paints each cell at fault light red with Interior.Color and RGB. The log then shows its own gaps before anyone builds a figure on them.
The log grows every week: will the macro still reach the newest rows without me editing the code?
Yes: The Complete Excel Course with AI Integration builds a function whose whole job is finding the end of the data. GetLastUsedRow, written in Lesson 145, searches the sheet from the bottom up for the last cell holding anything and hands that row number to every check, and the lesson proves it by adding one row and running it again: the answer moves on by one. Each loop then runs from the first data row to that number, so an incident logged this morning is checked with the rest, and nobody edits a range in the code. Two guards come with it: the function returns zero on an empty sheet, and Lesson 146 stops with a message when a sheet holds only headers. Because the function is declared Public, every later macro can call it.
Can one row of the log carry every fault it has, such as a missing site and lost days that are not a number?
Yes, in one cell, with the faults joined by a separator. The Complete Excel Course with AI Integration builds that message in Lesson 148: a text variable called FlagText is emptied at the start of each row, every failed check adds its own words after a pipe, and the finished message is written into the flag column, so a single row can name both its empty region and its empty salesperson. The lesson's warning about emptying it matters on a safety log: skip that step and one row's faults spill into the next. Lesson 152 meets the same issue between whole routines, when the number check is changed to add its message after the others instead of overwriting them. On your log, a supervisor reads every gap in an entry at once and puts the record right in one visit, instead of coming back three times.
How does the macro start each weekly run with a clean flag column?
By wiping it first, with the opening routine of FormatWizard's checks. Lesson 146 of The Complete Excel Course with AI Integration builds a macro that clears every message from the flag column and removes every fill colour from it, from the first data row to the last used one, before any new check runs; the lesson tests it by typing a stray note and a yellow fill into the column and watching both disappear. In Lesson 152 that clean-up becomes the first call of the master macro, so every weekly run starts from a blank column. For an incident log this matters more than it looks: an old flag left on an entry that was corrected a week ago sends a supervisor chasing a problem that no longer exists, and the safety meeting soon stops trusting the list.
Could I record a macro that formats a serious incident row the same way every time, without writing code?
Yes: the macro recorder writes the code while you work, and The Complete Excel Course with AI Integration starts there. In Lesson 137 you name a macro, give it a keyboard shortcut, format one row bold, italic and highlighted, stop recording and replay it with a keystroke. Recorded that way it always formats the same fixed row, which is where Lesson 138 comes in: with Use Relative References switched on, the recording follows your movement from the starting cell, so one shortcut formats whichever row you select, the real test being a row other than the one you recorded on. For an incident log, that is one key to mark a serious event in your house style. The lesson also points to the Personal Macro Workbook, which keeps a macro ready whenever Excel opens on your computer, and warns that Undo cannot reverse a macro.
Can site supervisors run the check themselves from a button?
Yes, and The Complete Excel Course with AI Integration sets that up before any code is written. In Lesson 139 the Developer tab is turned on from Excel's options, a macro is run from its Macros button, and then a macro joins the Quick Access Toolbar with an icon of your choice, so it starts with a single click from any sheet. Once the master check exists, that same button runs the whole audit for a supervisor who has never opened the code. The lesson is shown on Windows and notes that on a Mac the screens look slightly different, so a mixed office follows the same steps by a slightly different route. Every click runs the same steps in the same order, the consistency the first lesson of FormatWizard puts at the heart of macros: one routine that behaves the same for you and for a colleague.
Will the macros survive when a colleague saves the log, and will their Excel let the code run?
Yes: the macro-enabled .xlsm format keeps the code in the log for everyone, and The Complete Excel Course with AI Integration covers both halves. Lesson 140 shows the trap first: a normal Save on a workbook with code brings up Excel's warning, because the standard .xlsx format strips out every macro, so the log is saved once with Save As as an Excel Macro-Enabled Workbook, which keeps the code with the data. Then Lesson 142 deals with the yellow bar announcing that macros have been disabled: Enable Content lets the code run, and the lesson's rule is to enable it only for files you trust. Tell colleagues that the shared log is that trusted file, keep the one .xlsm copy everyone opens, and the weekly check is there for whoever needs to run it.
If ChatGPT drafts a macro for the near-miss log, what do I still check before running it on the real register?
Three things, each taught in The Complete Excel Course with AI Integration. First, that you can read it: Lesson 148 hands pieces of the macro to Claude or ChatGPT, each working in its own window, and then has you put right what comes back, which works because the earlier lessons have taught what each line does. Second, that it reads the right cells: Lesson 151 prints values to the Immediate window with Debug.Print, so you see which rows and columns the code touches before it writes a single flag across hundreds of entries. Third, that a typing slip cannot hide: Option Explicit, from Lesson 144, refuses any variable the code never declared, a fault that is easy to miss in code you did not type yourself. Run the draft on a copy, never on the live register, because Undo cannot reverse what a macro has done.
The IT team talks about Power Automate: is a VBA macro still the right tool for checking the incident log?
Yes: VBA is the faster tool for checks inside the log itself, and The Complete Excel Course with AI Integration teaches Power Automate as well, so you choose by the job. A macro lives in the workbook and, in FormatWizard, flags and colours every fault in one pass down the sheet. A Power Automate Desktop flow works from outside: it opens files, reads and writes cells and branches on answers, and Lesson 185 says plainly that a VBA macro usually runs faster over a long sheet, while a flow shows its logic visually, readable and free of code. So the weekly audit of the log suits VBA, and a routine that opens workbooks and writes results from outside suits a flow, built on AutoFlow. The course's requirements name Windows for the Power Automate lessons, not for the VBA ones.
Can the macro say what went wrong instead of crashing in front of a supervisor?
Yes: an error handler does exactly that, and The Complete Excel Course with AI Integration builds one into the master macro in Lesson 152. The routine starts with On Error GoTo, so a problem jumps to a short block that switches screen updating back on and shows the error's description in a message box, instead of the run crashing halfway. The same lesson fixes a compile error caused by a misspelt routine name, the kind of slip everyone meets, and Lesson 142 has already shown a missing End With line found and corrected. With Debug.Print from Lesson 151 to watch values as the code runs, you can trace a fault yourself, and a supervisor who meets a problem reads a plain message they can pass on to you, instead of a box of code they cannot read.
Will I be handed ready-made safety macros to paste in, or do I write my own?
You write your own, which is what makes them yours to adapt, and The Complete Excel Course with AI Integration gives you everything to check them against. FormatWizard comes as a starter workbook and a completed, macro-enabled one, so each routine you type can be compared with a finished version that works. The routines are built to be reused: the last-row function of Lesson 145 is called by every later check, and the master macro of Lesson 152 simply calls the clean-up, the blank checks and the number check in order. Adding a check for your log means writing one more routine in the same pattern and one more call. Copied snippets break on the first column that differs from their author's; code you understand bends to your incident log, your inspection sheet and next year's form.
Will the check crawl through a log of several thousand rows, or finish quickly?
It finishes quickly, and The Complete Excel Course with AI Integration shows what keeps it that way. FormatWizard's own sheet runs to thousands of rows of sales data, so every check in the section is built and run on a sheet of real length, not a toy of twenty lines. In Lesson 152 the master macro switches screen updating off while it works, so Excel does not redraw the sheet after every flag, and switches it back on at the end or in the error handler. The checks themselves are single loops from the first data row to the last used one, with no copying or sorting along the way. Lesson 185 adds the comparison with a desktop flow and says it plainly: over a long sheet, a VBA macro usually runs faster than a flow working row by row.
How far into the course before the weekly log check is a single button?
About 1 hour 16 minutes, the whole of this path, and the pieces start paying off well before the end. In The Complete Excel Course with AI Integration the recorder and a button are working by Lesson 139, so a formatting chore can be one click within the first few lessons. Hand-written checks start at Lesson 146, and by Lesson 149 a loop is flagging and colouring every blank in a column; the number check, debugging and the master macro with its error handler finish the job in Lesson 152. Build each routine on a copy of your own log beside the practice sheet, and it is ready to run before the next monthly report. Lifetime access keeps every lesson open when a new form adds columns to check, and finishing the course earns a Certificate of Completion with a verification link.
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 health and safety officers
- Lookups for health and safety officers
- Pivot tables for health and safety
- Charts for health and safety officers
- Dashboards for health and safety
- Conditional formatting for HSE officers
- Data cleaning for health and safety
- Data validation for health and safety
- Excel tables for health and safety
- Text functions for health and safety
- Date functions for health and safety
- Dynamic arrays for health and safety
- Power Query for health and safety
- Power Pivot & DAX for health and safety
- Power Automate for health and safety
- Copilot for health and safety
- ChatGPT for health and safety
- Claude in Excel for health and safety