worksheet calculate repeatedly calling itself
I've found out that worksheet change will not pick up when my cell changes
(the cell is linked by DDE to another application). So I'm picking up the change using worksheet calculate, but the procedure is repeatedly calling itself, despite me using Application.EnableEvents to disable the events during the procedure. Add_new_record is the procedure that keeps being repeated, but I only want it to run once. Any ideas? Here is the code; Sub Worksheet_Calculate() If Range("Q1").Value = "1" Then Application.EnableEvents = False Add_new_record End If Application.EnableEvents = True End Sub Thanks, Craig. |
worksheet calculate repeatedly calling itself
Application.EnableEvents would disable events from firing. From the code
shown, it is impossible to diagnose why you might be getting unexpected results. However, once Q1 takes on the value of 1, everytime there is a calculation, you will fire the Add_new_record macro. If you are trying to react to a DDE update, then try using SetlinkonData which is a property of the Workbook object. -- Regards, Tom Ogilvy "CraigB" wrote in message ... I've found out that worksheet change will not pick up when my cell changes (the cell is linked by DDE to another application). So I'm picking up the change using worksheet calculate, but the procedure is repeatedly calling itself, despite me using Application.EnableEvents to disable the events during the procedure. Add_new_record is the procedure that keeps being repeated, but I only want it to run once. Any ideas? Here is the code; Sub Worksheet_Calculate() If Range("Q1").Value = "1" Then Application.EnableEvents = False Add_new_record End If Application.EnableEvents = True End Sub Thanks, Craig. |
All times are GMT +1. The time now is 02:22 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com