473,511 Members | 14,951 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

stop a procedure

142 New Member
In excel VBA.
For example,
Expand|Select|Wrap|Line Numbers
  1. If cells(i,1)=1 Then
  2.   Call Procedure1
  3.   Call Procedure2
  4. End If
  5. If ....
  6.   ...
  7. End If
  8. Loop
The Procedure1 and 2 will execute every loop, but I only want the Procedure1 excutes once, and the procedure2 excutes everyloop. How can I do that?
thanks
Apr 30 '07 #1
4 1302
Killer42
8,435 Recognized Expert Expert
Probably the simplest way is to create a variable which you use to "flag" the fact procedure 1 has been run. Each time 'round the loop, if the flag hasn't been set, then run procedure 1 and set the flag.
Apr 30 '07 #2
joemo2003
142 New Member
Probably the simplest way is to create a variable which you use to "flag" the fact procedure 1 has been run. Each time 'round the loop, if the flag hasn't been set, then run procedure 1 and set the flag.
what is flag? I try to figure out "Flag" a long time ago, but still can't.
May 1 '07 #3
Killer42
8,435 Recognized Expert Expert
what is flag? I try to figure out "Flag" a long time ago, but still can't.
The term "flag" just refers to a variable that you use to indicate a particular situation. In this case, a boolean variable that you would set to True to indicate that you have performed the thing you only want to do once.

Here's some pseudo-code showing a general example (based on your situation) of the way a flag might be used...
Expand|Select|Wrap|Line Numbers
  1. Clear flag (set to False)
  2. Start loop
  3.   If Flag is not set Then
  4.     Do Proc1
  5.     Set flag (set value to True)
  6.   End If
  7.   Do Proc2
  8. End Loop
May 1 '07 #4
joemo2003
142 New Member
The term "flag" just refers to a variable that you use to indicate a particular situation. In this case, a boolean variable that you would set to True to indicate that you have performed the thing you only want to do once.

Here's some pseudo-code showing a general example (based on your situation) of the way a flag might be used...
Expand|Select|Wrap|Line Numbers
  1. Clear flag (set to False)
  2. Start loop
  3.   If Flag is not set Then
  4.     Do Proc1
  5.     Set flag (set value to True)
  6.   End If
  7.   Do Proc2
  8. End Loop
great, thanks
May 1 '07 #5

Sign in to post your reply or Sign up for a free account.

Similar topics

2
7199
by: Simon Niederberger | last post by:
Hi I've written a Windows Service which has - several (0-100) listeners threads which spawn worker threads based on events, timers etc - several (0-300) worker threads which handle data...
5
27283
by: Paul O. Morris | last post by:
Is there a script that I can run to stop a particular SQL server service on Win2003 server? I'm looking for a similar script to restart that service as well. Thanks.
16
12639
by: deko | last post by:
I have a sub routine that searches the Outlook PST for a message sent to/from a particular email address. Obviously, this can take a long time when the PST contains thousands of messages. I'd...
2
1959
by: Gustavo\ | last post by:
Hi, I have a combo box in a form. It has limit to list set to "yes", and I have declared a NotOnList event procedure to take care of adding a value not on the list. Now, my problem is that,...
1
2234
by: magic man via .NET 247 | last post by:
hi everyone i have a c# application that uses multithreading toconnect to sql server and execute a stored procedure on theserver. i am using a dataset,sqlcommand,dataadapter and adatagrid to carry...
2
1592
by: McGeeky | last post by:
I use page_load to call a stored procedure and populate the form. When the user clicks the OK button on the form I have implemented an event handler behind it (OKButton_Click()) that calls another...
3
1706
by: Roger Withnell | last post by:
I have a framed website. I plan to include in default.asp a routine to check if the annual subscription is due from the records in the People table. If so, then the routine would send emails...
51
54771
by: Hans | last post by:
Hi all, Is there a way that the program that created and started a thread also stops it. (My usage is a time-out). E.g. thread = threading.Thread(target=Loop.testLoop) thread.start() ...
1
1064
by: Simone | last post by:
Hello In visual studio when I am debugging my ASP. net code if I hit "stop" the procedure I am in will still finish itself and doesn't stop where I expect it to stop. I remember in VB when...
1
3492
by: pssheba | last post by:
Hi, My sp creates an error report. at a certain stage i want it to stop running if there are errors in thar report. I wrote: DECLARE @myparam INTEGER SELECT @myparam=COUNT(*) FROM...
0
7237
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
1
7074
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7506
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
1
5063
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
4734
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
3219
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1572
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
780
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
445
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.