How to Reset a Dependent Cell in Excel Online Using Office Scripts
Question details
The user needs to automatically reset the value of a dependent cell when its parent cell is modified in Excel Online.

- Product
- Excel Online
- Device & OS
- not provided
- Scenario
- Modifying a parent dropdown or data validation cell and needing the dependent cell to clear or reset its value automatically.
- Observed behavior
- Excel Online does not support VBA, and Office Scripts do not have built-in triggers to run automatically when a cell value changes, preventing the dependent cell from resetting.
Ensure you have access to both Microsoft Excel Online and Microsoft Power Automate, as combining these tools is required to trigger scripts automatically on the web.
Automate Cell Reset Using Office Scripts and Power Automate
Create an Office Script to clear the dependent cell and use a Power Automate flow to trigger the script when the workbook is modified.
Because Excel Online does not support traditional VBA event triggers like Worksheet_Change, you cannot trigger an action directly from a cell edit. Instead, you must write an Office Script to perform the reset action and rely on Power Automate to detect file modifications and execute the script.
Open your workbook in Excel Online, navigate to the 'Automate' tab, and select 'New Script'. Write a TypeScript code snippet that clears the contents of your dependent cell (e.g., workbook.getWorksheet('Sheet1').getRange('D2').clear();) and save the script.
Log into Microsoft Power Automate and create a new automated cloud flow. Set the workflow trigger to 'When a file is modified' and point it to the OneDrive or SharePoint location of your Excel file.
Add a new action step to the flow, search for 'Excel Online (Business)', and select 'Run script'. Choose your file and the Office Script you just created, then save and test the flow.

Use WPS Office to Easily Run VBA Macros for Cell Automation
While Excel Online requires complex Power Automate workflows to reset dependent cells, WPS Office offers full desktop VBA support for free. You can easily use standard Worksheet_Change events to automate your spreadsheets natively.
- 1. Download and Install: Download WPS Office for free and install the lightweight application on your computer.
- 2. Open Your Workbook: Launch WPS Spreadsheet and open your Excel workbook. WPS fully supports .xlsm macro-enabled files.
- 3. Add VBA Event Code: Navigate to the Developer tab, open the VBA Editor, and add standard Worksheet_Change event code to instantly reset your dependent cells without external triggers.

Frequently Asked Questions
Can I use VBA macros in Excel Online?
No, Excel Online does not support VBA (Visual Basic for Applications). To run automated scripts on the web version of Excel, you must use Office Scripts.
Do Office Scripts run automatically when a cell changes?
Currently, Office Scripts do not have built-in event triggers like VBA's Worksheet_Change. They must be executed manually by the user or triggered automatically by an external service like Power Automate.
How do I clear a cell value using Office Scripts?
You can clear a cell value by targeting the specific range and using the clear() method in your TypeScript code. For example: workbook.getWorksheet('Sheet1').getRange('D2').clear();.
Are there free alternatives that support standard VBA automation?
Yes, desktop applications like WPS Office Spreadsheet natively support VBA and macro execution. This allows you to use standard event triggers for cell automation without requiring premium cloud workflow subscriptions.




