The Complete Excel Course with AI Integration
Excel macros and VBA for sales teams
Before a sales report goes out, someone scrolls thousands of orders looking for a blank region, a missing salesperson or a word where a figure belongs, then formats the same rows the same way as last week. The Complete Excel Course with AI Integration hands both jobs to macros and VBA on FormatWizard, an industry-standard project built on a sales sheet. This page picks out the whole macro section, from a first recording to one master macro you wrote.
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 a problem row, such as an order with a negative amount, and run it from a keyboard shortcut.
- Switch to relative references so one recording formats whichever order row you select, then put it on a button or the Quick Access Toolbar for the team.
- Save sales workbooks with macros as .xlsm and know which trust settings decide whether a colleague's copy will run the code.
- Open the VBA editor with Alt+F11, keep macros in modules of their own and write code that points at the sales sheet by name.
- Write GetLastUsedRow, a function that finds the last order on a sheet of any length, so every check reaches the newest rows.
- Loop through every order with For Next and If tests, flag a missing region or salesperson in one FlagText message per row, and colour the cells at fault.
- Flag any entry in a number column that is not a number, such as a word or N/A in the per-unit figure, with IsNumeric.
- Gather every check into one master macro with an error handler, debug it with Debug.Print and run it before the report goes out.
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 on a sales sheet of thousands of orders, each with a date, region, salesperson, units, a per-unit figure and an amount: by the end your own VBA clears the last run's flags, marks every missing region and salesperson, catches non-numbers and reports back in a single run.
-
Project 13
AutoFlow
The weekly report routine, run by a flow instead of by you.
The other half of sales automation, on Windows: Power Automate Desktop opening the starter weekly sales workbook, reading its rows, recording an approval and writing it back, for routines that reach beyond one workbook.
-
Project 03
Sales Goal Tracker
Where the logic of a VBA If begins: IF, IFS, AND and OR labels on a table of sales with quotas, the same tests a macro later runs row by row, and the formula side of commission and bonus rules.
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 if you can enter data and write a simple formula: the section assumes no programming at all. New to Excel? Begin at Lesson 1, and you will meet absolute and relative references (Lesson 10) and an IF that labels sales Achieved or Missed (Lesson 30), the two ideas the recorder and your first If statement build on. Recording macros already? Jump to Lesson 141, where the VBA editor opens.
17 of 186 lessons · 1 h 16 min
14 VBA and macros in Excel: FormatWizard Macros before code: FormatWizard's sales sheet toured, a first recording that formats a row with a negative amount, relative references so the same keystroke fixes whichever row you are on, a button and the Quick Access Toolbar, and the .xlsm format that keeps the macros when you save.
- 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 Inside the VBA editor: three ways to open it, the workspace and its modules, then macro security and trust settings, the yellow bar a colleague sees when your sales workbook opens, and a first compile error fixed.
- 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 First code on the sales sheet: a variable that points at it by name, Option Explicit and declared data types, the difference between a Sub and a Function, and GetLastUsedRow, which finds the last order however many rows the export holds.
- 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, one to a lesson: last run's flags and fills cleared, a For Next loop that flags every missing region, a FlagText message that adds a missing salesperson to the same row's note, light red cells at fault, and IsNumeric on the per-unit figure and the amount.
- 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 Finishing safely: Debug.Print and the Immediate window confirm the code reads the right orders before it writes a flag, then one master routine runs every check with screen updating off and an error handler that says what went wrong.
- 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.
Can Excel macros and VBA take the weekly checking and formatting off a sales team's hands?
Yes, both, and The Complete Excel Course with AI Integration from Coding Liquids teaches them on a sales sheet: the formatting repeated every week, the checks made by eye before a report goes out, and the running of both in one go. FormatWizard, the course's macro project, is industry standard, designed after talking with people from many different industries, and its data is orders: a date, region, salesperson, units, a per-unit figure and an amount on every row. You record a macro that formats a problem row (Lesson 137), make it follow whichever row you select (Lesson 138) and put it on a button (Lesson 139). Then you write VBA that walks every order, flags missing regions and salespeople, catches entries that are not numbers and reports back from one master macro (Lesson 152). All of it fits in 17 lessons, 1 hour 16 minutes of video, the complete macro section of the course.
Before the weekly sales report goes out, can a macro check every order for a missing region or salesperson?
Yes, every order in one run, which is what FormatWizard in The Complete Excel Course with AI Integration is built to do. The finished macro starts by clearing the last run's flags and fills (Lesson 146), then a For Next loop visits each row from the first order to the last, found by your own GetLastUsedRow function however long the sheet grows (Lesson 145). An If test on the trimmed region cell writes Region missing in the flag column, so a cell holding only spaces still counts as empty (Lesson 147); a second test adds Salesperson missing to the same FlagText message, so a row with both faults says so once (Lesson 148); the cells at fault turn light red (Lesson 149); and IsNumeric flags any entry in the per-unit column that is not a number, a word or a note such as N/A (Lesson 150). RunFullValidation chains it all, with screen updating off for speed and an error handler that reports a problem instead of crashing (Lesson 152).
Returns and credit notes show as negative amounts: can a recorded macro format them for the sales pack?
It can format any one of them in a keystroke, and The Complete Excel Course with AI Integration starts exactly there. Lesson 137 records NegativeAmount on a row holding a negative amount: bold, italic and a highlight, stored in the workbook and run with Ctrl+Q. Recorded with absolute references, it always formats that same row, so Lesson 138 records it again with Use Relative References, and Ctrl+Shift+Q then formats whichever row you start from, the real test being a second negative row further down. Two points the lessons make matter on a sales sheet: Ctrl+Z cannot undo a macro, so try it on a copy first, and the recorded code formats the row it is given without checking that the amount is negative (Lesson 142). Finding those rows by itself is the work of a loop with an If test, the structure the later lessons build, so the recording is your first step and not your last.
Should our commission and bonus rules live in a macro or in formulas?
In formulas, with a macro checking the data they feed on, and The Complete Excel Course with AI Integration teaches both halves. Rules that pay people need to be visible and to recalculate the moment a sale changes, which is what worksheet formulas do. The Sales Goal Tracker builds them: IFS assigns a band in order, with TRUE catching whatever is left (Lesson 32), AND makes bonus eligibility depend on beating quota and an excellent rating together (Lesson 33), and SUMIFS totals each person's sales for the period (Lesson 37). A macro's job is upstream: before anyone's commission is worked out, FormatWizard's loop marks rows with no salesperson, the sale nobody would be credited for, and IsNumeric flags a word sitting in the per-unit or amount column (Lesson 148 to Lesson 150). Quote and invoice templates filled by VBA are not in the lessons; the checking routine that protects every commission run is, line by line.
Conditional formatting already colours blanks in our sales sheet: what does a VBA check add?
A written reason on every row, and a check that runs the same way for whoever presses the button; The Complete Excel Course with AI Integration teaches both tools, so you see the difference first hand. A colour rule shows that a cell is empty. FormatWizard writes what is wrong in a flag column, gathering every fault on a row into one FlagText message, Region missing and Salesperson missing side by side (Lesson 148), then colours the cells as a second layer (Lesson 149). It clears the previous run's messages and fills first, so old flags never mislead (Lesson 146), and it tests what a colour rule handles poorly, such as an entry in a number column that is not a number (Lesson 150). Text flags can be filtered, counted and sent back to the rep who owns the row. Colour rules keep their place as quick visual warnings, and the course builds those too, from highlight rules and icon sets (Lesson 15) to the overdue highlighting of TaskFlow (Lesson 82).
What should a sales team know before running macros on the live sales workbook?
Five habits, each taught in The Complete Excel Course with AI Integration before your code goes near real orders. Save as a macro-enabled .xlsm, since a standard .xlsx strips every macro out when it is saved (Lesson 140). Click Enable Content on the yellow bar only for workbooks you trust, because macro security decides which files may run code (Lesson 142). Test on a copy, since Ctrl+Z cannot undo what a macro did (Lesson 137). Before the code writes a single flag, use Debug.Print and the Immediate window to confirm it reads the right cells in the right order, so a mistake cannot spread across thousands of orders (Lesson 151). And give the finished macro an error handler that reports what went wrong (Lesson 152). For the team, the Developer tab, a button and the Quick Access Toolbar put the macro one click away (Lesson 139), and the Personal Macro Workbook keeps a favourite available in every file on that computer.
Will VBA still matter for sales operations once AI writes code and Power Query cleans the exports?
Yes, because each tool has its own job, and The Complete Excel Course with AI Integration teaches all of them, so you choose rather than guess. Power Query is the tool for exports a CRM produces again and again: it combines every regional or period file in a folder into one table (Lesson 166), a sounder route than a macro that opens and pastes files. Power Automate Desktop drives Excel from outside, on Windows, for routines that reach across programs (Lesson 174). AI drafts code in seconds, and what it writes for a desktop macro is VBA, which someone still has to read and test. VBA holds the ground in the middle: checking and formatting the sheets your team types into, row by row, at one click. A sales operations analyst who knows all four picks the right tool for each chore, a skill worth more than mastery of any single one.
Can ChatGPT write the macro that checks our order sheet, so nobody has to learn VBA?
It can draft it, and The Complete Excel Course with AI Integration shows why someone on the team still has to read it. In Lesson 148 the two-check loop is set as a challenge, then learners write parts of it with ChatGPT or Claude and correct what comes back. The lessons point to exactly the slips an assistant makes: a flag message that is not emptied for each row carries one order's faults onto the next (Lesson 148); copy the region line to make the salesperson line, forget to change column B to C, and the wrong column lights up (Lesson 149); an undeclared variable is the typo Option Explicit exists to catch (Lesson 144). Debug.Print then shows what the code reads before it writes anything (Lesson 151). With those skills, an assistant types faster than you and you decide whether the macro is right, the only safe arrangement for a workbook the whole sales team relies on.
Every Friday the sales pack is formatted, checked and sent by hand: which of those steps can a macro take?
The first two, completely, and The Complete Excel Course with AI Integration builds both. Formatting is a recording: the steps you take on a problem row become a macro you replay with a shortcut or a button, made to follow whichever row you select (Lesson 137 to Lesson 139). Checking is the VBA you write: one master macro clears last week's flags, marks missing regions and salespeople, catches non-numbers and confirms it has finished, or says what went wrong (Lesson 152). Sending is where the lessons stop, since VBA that drives Outlook or saves a PDF is not taught. For the routine around the workbook, Power Automate Desktop on Windows opens the file, reads it, records an approval and saves it, started from a shortcut or a link (Lesson 180). Together that turns Friday's pack from an afternoon of scrolling into a few clicks and a final read.
Sales operations job ads ask for VBA: will FormatWizard give me something to show?
Yes: a working validation macro you wrote yourself, which The Complete Excel Course with AI Integration gives you along with the finished file to compare it against. FormatWizard comes as a starter workbook of sales records and a completed .xlsm, so you can set your code beside the working version, and every routine in it is one you can explain: GetLastUsedRow and why it searches upwards from the bottom (Lesson 145), the Public keyword that lets other modules call it (Lesson 146), the loop and the FlagText basket (Lesson 148), the RGB colour (Lesson 149), IsNumeric (Lesson 150) and the error handler with screen updating switched off for speed (Lesson 152). Asked in an interview how you would stop bad data reaching a sales report, you can open it and walk through it. Completing the course adds a Certificate of Completion with a verification link an employer can check.
How long until a macro is checking our own sales sheet, and does it need Windows?
About 1 hour 16 minutes of video for the whole section, and the first macro earns its keep long before the end. By Lesson 140 of The Complete Excel Course with AI Integration you have a recorded formatting macro on a button, saved in a macro-enabled workbook, without a line of code typed. The checks follow one short lesson at a time until Lesson 152 joins them. To point them at your own sheet, change the sheet name the code looks for and the column letters it tests: the structure stays the same. Windows is not needed, because the course's requirements name it for Power Pivot and Power Automate only, so a Mac follows every macro lesson, with screens that look slightly different from the recordings (Lesson 139). The keyboard shortcuts shown, Alt+F11 among them, are the Windows ones. Lifetime access keeps the section open for the next chore that deserves a macro.
Is the VBA section pitched at sales people who have never programmed?
Yes, and the sales data itself makes it easier, because every example is a sheet you already understand. The Complete Excel Course with AI Integration starts with no code at all, recording, running and saving macros (Lesson 136 to Lesson 140), and when code arrives the lessons explain it in plain pictures: a variable is a nickname for a long contact name (Lesson 143), and the row counter in a loop is a finger moving down the order list (Lesson 147). A VBA If makes the same decision the IF function makes when the Sales Goal Tracker labels a sale Achieved or Missed (Lesson 30), so the logic is familiar before the syntax is. Each lesson adds one idea to the same macro, and the finished workbook is there to compare when yours misbehaves. With the instructor support plan, a question sent from under any lesson is answered by the instructor in writing.
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
- Excel formulas for sales teams
- XLOOKUP and VLOOKUP for sales
- Pivot tables for sales teams
- Excel charts for sales teams
- Excel dashboards for sales teams
- Conditional formatting for sales
- Data cleaning for sales teams
- Data validation for sales teams
- Excel tables for sales teams
- Text functions for sales teams
- Date functions for sales teams
- Power Query for sales teams
- Power Pivot and DAX for sales teams
- Power Automate for sales teams
- Copilot in Excel for sales teams
- ChatGPT for Excel for sales teams
- Claude in Excel for sales teams