View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default Macro that stops at a mid point occasionally

Sub TestGoto()
msgbox "Before Goto"
goto Line177

Msgbox "before Line177"

Line177:

Msgbox "after Line177"

End Sub

Line177 is a label the way he has it set up and it is legal.

--
Regards
Tom Ogilvy

"N10" wrote in message
...
This may be off the MArk but as far as I know and Im willing to be

corrected
but it seems to me that

GoToLine177 is therefore perhapes not a correct Excell VBA command
therefore such will hang or generate an error

As far as I know Excel modules and proceedures dont have line numbers

The nearsest thing I know of is the case command ?

Hope this helps

N10



"Ed" wrote in message
...
Dave
It stopped in this loop:

Do Until amtWon = 0
If amtWon = 0 Then GoTo Line177
amtWon = amtWon - 1
accumTotal = accumTotal + 1
Worksheets("abc").Range("bl16").Value = amtWon
Worksheets("abc").Range("bl17").Value = accumTotal
Worksheets("abc").Range("zf16,u17").Calculate
Loop

I also have had occasions in other macros where it would
stop on lines where a comparison is being made.
Such as:

If abcd efg Then (Goto Line10)

In all cases, they basicly work great.
Just once in a while they stop.
This tells me, it must be written correctly because it
works most of the time.
Just occasionally, something is messing it up.
Am I thinking correctly?
If for some unknown reason a cell is drifting from numeric
to otherwise, could a line be put in to guarantee it
staying numeric or putting it back to numeric just before
it is used?
If so, what would that line be?
Just trying to think outside the box.
Thankyou
Ed


-----Original Message-----
I don't think that you shared enough for any real help.

But when my macros stop, it's usually because of my code

and my data (in the
cells).

Sometimes, I'll look for a value and assume that it'll be

numeric and it isn't
(crash!).

Sometimes, I'll look at the value of a cell and it'll

contain an error (crash!).

If you can find the line that's crashing, maybe you can

see what it's looking
at. Then go back to check your data.

On the other hand, I've had macros that crash just because

of errors in the
code, too.



Ed wrote:

Hi
This Macro almost always runs to completion.
But occasionally will stop at some mid point.
Sometimes stops at the same mid point.
I have reentered the lines at the stopping point.
This has not helped.
Do you know of anything to look for or do?
Are there any dummy lines that could be entered that would
possibly help or correct this?
Or is this just an uncorrectible computer problem?
What is your thinking on this?
Thankyou
Ed

--

Dave Peterson

.



---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.772 / Virus Database: 519 - Release Date: 01/10/2004