Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
ed ed is offline
external usenet poster
 
Posts: 59
Default Macro that stops at a mid point occasionally

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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Macro that stops at a mid point occasionally

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

  #3   Report Post  
Posted to microsoft.public.excel.programming
ed ed is offline
external usenet poster
 
Posts: 59
Default Macro that stops at a mid point occasionally

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

.

  #4   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Macro that stops at a mid point occasionally

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


  #5   Report Post  
Posted to microsoft.public.excel.programming
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






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Macro that stops at a mid point occasionally

And for completeness, VBA does support line numbers:

Sub TestGoto()
MsgBox "Before Goto"
GoTo 177

MsgBox "before Line 177"

177 MsgBox "Line 177"

End Sub

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
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






  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,824
Default Macro that stops at a mid point occasionally

You could check for valid stuff with something like:

Dim abcd As Variant
abcd = Worksheets("sheet1").Range("a1").Value
If IsError(abcd) Then
MsgBox "an error"
ElseIf IsNumeric(abcd) Then
MsgBox "numeric)"
Else
MsgBox "not numeric"
End If


====

And this line wouldn't even compile for me:

If abcd efg Then (Goto Line10)
(if I dropped the parentheses, it did.)

=========

Do you use user defined functions? Sometimes if there's an unhandled error in
one of these, it can cause macros to stop.

And just curious about Line177. If that's just used to exit the loop, why not:

if amtwon = 0 then exit do

About the only time I use Goto's to branch somewhere else is when I'm branching
to my clean up code at the end of a procedure.

sub aaa()
application.screenupdating = false
application.calculation = ...

'do a bunch of stuff
'decide to exit early

if amtwon = 0 then goto ExitNow:

'lots more code

exitNow:
application.screenupdating = true
application.calculation = ...

End Sub

Lots of people don't like GoTo's anyplace. I don't mind branching to an exit
routine.

Ed wrote:

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

.


--

Dave Peterson

  #8   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default Macro that stops at a mid point occasionally

Thanks Tom

I didnt know that, the fact is a bonus I'll check it out

N10

"Tom Ogilvy" wrote in message
...
And for completeness, VBA does support line numbers:

Sub TestGoto()
MsgBox "Before Goto"
GoTo 177

MsgBox "before Line 177"

177 MsgBox "Line 177"

End Sub

--
Regards,
Tom Ogilvy


"Tom Ogilvy" wrote in message
...
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








---
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


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
Macro repeats and then stops Sabba Efie Excel Discussion (Misc queries) 2 August 15th 06 11:03 PM
Vb macro stops when I try to create more than 89 charts Tiberius Charts and Charting in Excel 0 January 19th 06 05:52 PM
Show method stops macro Syed Zeeshan Haider[_7_] Excel Programming 12 May 22nd 04 05:36 PM
Macro stops before beginning. y Excel Programming 7 April 12th 04 06:06 AM
macro stops midstream dvt[_2_] Excel Programming 3 February 23rd 04 03:46 PM


All times are GMT +1. The time now is 12:40 PM.

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

About Us

"It's about Microsoft Excel"