Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default 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.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default 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.



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
CALLING MACROS FROM A NEW WORKSHEET NSNR Excel Discussion (Misc queries) 4 February 1st 08 07:10 AM
calling macros from worksheet to another NSNR Excel Discussion (Misc queries) 3 October 27th 07 01:49 PM
Print a worksheet repeatedly with each list cell NN Excel Discussion (Misc queries) 1 October 11th 06 11:08 PM
calling up information from a different worksheet. Jay Adams Excel Worksheet Functions 0 October 8th 06 09:33 AM
Calling a macro in another worksheet Tolga[_2_] Excel Programming 2 August 5th 04 07:03 PM


All times are GMT +1. The time now is 07:50 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"