Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Why my procedure will re execute at a certain point in the procedu

I have several routines (one in a module, the other in "sub
worksheet_calculate()."

In both, the code will execute until it reaches an undetermined line number,
then it will go back to the start of the procedure, run the commands and then
return to the next line from where it re executed. It will do this until it
has finally completed all the commands in the routine.

It may be that in the "sub worksheet_calculate()" procedure (in the
spreedsheet code page) that it writes to the worksheet which triggers a re
calculation and then returns to the beginning of the routine. If so, why
then would it return to the next line after the trigger command? In the
module routine this is not true. It is called from another routine in a User
Form. I have tried trapping it, work arounds, etc but nothing corrects this
problem. I am at a total loss!

Would anyone have any idea of what is occuring, or has had a similar problem
with a resolution?

Your advice, comments or suggestions would greatly be appreciated.

I use XP pro and Excel - Office 2007.

Regards - Larry
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 333
Default Why my procedure will re execute at a certain point in the procedu

Try this:

Private Sub Worksheet_Calculate()

Dim ShName As String
Dim Grid As String

On Error GoTo ws_exit
Application.EnableEvents = False

your code

ws_exit:
Application.EnableEvents = True

End Sub


--
HTH
Karen53


"lwchapman" wrote:

I have several routines (one in a module, the other in "sub
worksheet_calculate()."

In both, the code will execute until it reaches an undetermined line number,
then it will go back to the start of the procedure, run the commands and then
return to the next line from where it re executed. It will do this until it
has finally completed all the commands in the routine.

It may be that in the "sub worksheet_calculate()" procedure (in the
spreedsheet code page) that it writes to the worksheet which triggers a re
calculation and then returns to the beginning of the routine. If so, why
then would it return to the next line after the trigger command? In the
module routine this is not true. It is called from another routine in a User
Form. I have tried trapping it, work arounds, etc but nothing corrects this
problem. I am at a total loss!

Would anyone have any idea of what is occuring, or has had a similar problem
with a resolution?

Your advice, comments or suggestions would greatly be appreciated.

I use XP pro and Excel - Office 2007.

Regards - Larry

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
Error when Execute New Procedure Created Using VBE Resant Excel Programming 3 September 8th 06 09:04 AM
execute stored procedure from excel maxzsim Excel Worksheet Functions 3 May 11th 05 04:58 PM
execute stored procedure Mark Goldin Excel Programming 3 April 7th 04 03:03 PM
Execute procedure on startup Richard[_20_] Excel Programming 4 March 3rd 04 11:36 AM
Execute stored procedure using DAO sapta wijaya Excel Programming 0 September 29th 03 04:24 AM


All times are GMT +1. The time now is 04:48 AM.

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"