logo
search
VBA & Macro Problems

Fix Excel VBA Change Event Not Detecting RTD Link Updates

Adam DavisAdam Davis Sep 28, 2026 869 views

Question details

The user needs to run a VBA macro automatically when real-time data (RTD) updates in Excel, but the standard Worksheet_Change event is not triggering.

How to Fix Excel VBA Change Event Not Detecting RTD Link Updates
Product
Microsoft Excel
Device & OS
not provided
Scenario
Monitoring real-time data feeds, such as stock market prices using RTD links, and attempting to trigger automated VBA scripts when the data values change.
Observed behavior
The Worksheet_Change event fails to fire because RTD link updates are processed as recalculation results rather than manual user edits or macro-driven changes.
Before you start

Ensure that your workbook is saved in a Macro-Enabled format (.xlsm) and that you have enabled macros in the Trust Center settings so your event code can execute.

Solution 1Recommended

Use the Worksheet_Calculate Event to Monitor RTD Changes

Since RTD updates trigger a recalculation on the worksheet, utilizing the Calculate event alongside a static variable is the most effective way to detect when a value has changed.

The standard Worksheet_Change event only detects physical edits made by users or other macros. To catch RTD updates, you must monitor the recalculation phase. By storing the cell's previous value in a variable, you can compare it against the new value every time the sheet calculates. If they differ, the RTD link has updated.

1
Declare a global variable

Open the VBA Editor by pressing Alt + F11. Insert a standard module and declare a Public variable (e.g., Public PreviousValue As Variant) to hold the last known RTD value.

2
Initialize the variable on startup

Double-click 'ThisWorkbook' in the Project Explorer and use the Workbook_Open event to assign the initial value of your RTD cell to your global variable.

3
Add the Calculate event

Double-click the specific Sheet module where the RTD link is located. Select 'Worksheet' from the left dropdown menu and 'Calculate' from the right dropdown menu to create the Worksheet_Calculate subroutine.

4
Compare values and execute code

Inside the Worksheet_Calculate event, write an IF statement that compares the current value of the RTD cell to your global variable. If they are different, run your desired macro code, and finally, update the global variable to match the new cell value.

Use the Worksheet_Calculate Event to Monitor RTD Changes
Preventing Infinite Loops: If your macro modifies other cells, it will trigger another calculation. Wrap your action code with Application.EnableEvents = False before executing, and set it back to True afterwards.
Free Microsoft Office alternative

Try WPS Office for Seamless Macro Compatibility

If you are dealing with complex Excel VBA limitations, WPS Office Spreadsheets offers robust compatibility with Microsoft Office file formats and VBA macros. It is lightweight, fast, and designed to handle extensive datasets without the hefty subscription costs.

  1. 1. Download and Install: Visit the WPS Office website and download the free installation package for your operating system.
  2. 2. Open Your Workbook: Launch WPS Spreadsheets and open your existing Macro-Enabled (.xlsm) files directly.
  3. 3. Enable Macros: Click 'Enable Macros' when prompted by the security warning to allow your VBA scripts and calculation events to run.
High compatibility with Microsoft Excel (.xlsx, .xlsm, .xls) formatsBuilt-in support for VBA macros in advanced versionsFamiliar user interface ensuring zero learning curveFree, lightweight, and fast-loading office suite
microsoft office alternative - wps office

Frequently Asked Questions

Why doesn't the Worksheet_Change event fire for formula updates?

The Worksheet_Change event is specifically designed to trigger only when a user manually edits a cell or when a macro explicitly writes a value to it. Formula recalculations and RTD updates do not count as physical changes to the cell contents.

Can I use the Application.OnTime method instead of the Calculate event?

Yes, you can set up a recursive Application.OnTime macro to check cell values at regular intervals (e.g., every 5 seconds). However, the Worksheet_Calculate event is generally more responsive and efficient for detecting immediate data updates.

Does this solution work for DDE (Dynamic Data Exchange) links as well?

Yes. DDE links, much like RTD links, bypass the standard Change event. The Worksheet_Calculate method using a stored variable works effectively for both DDE and RTD updates.