A family of Microsoft spreadsheet software with tools for analyzing, charting, and communicating data
Hi @SURGEON H
I'm just a fellow community user, so please treat this as general guidance.
As far as I know, Office Scripts don't have an equivalent of VBA's Worksheet_Change event. A script runs only when someone runs it manually (or through a button), or when Power Automate calls it, so it can't run automatically each time a cell is edited.
Depending on what kind of checks you need, here are some alternatives:
- Data Validation: if the checks are about allowed values, formats, dates, number ranges or text length, Excel's built-in Data Validation (Data > Data Validation) checks entries instantly as people type, without any script. It also works in Excel for the web and with co-authoring.
- Conditional Formatting: you can highlight invalid or missing entries with formula-based rules, so your team can see problems right away.
- Power Automate on a schedule: if the checks are more complex, you can create a scheduled flow that runs your Office Script (for example every hour) and flags or reports invalid entries. This isn't real time, and the Run script action has a daily limit of 1,600 calls per user, so choose the schedule carefully.
- Excel add-in: if you really need code to run on every change, the Excel JavaScript API used by Office Add-ins supports an onChanged event for worksheets and tables. However, this requires building and deploying an add-in, which is more work than an Office Script.
Could you share what kind of checks you want to run on the employee information (for example required fields, duplicates, or specific formats)? That would help suggest the simplest option.