ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   On error resume next statement ignored! (https://www.excelbanter.com/excel-programming/289786-error-resume-next-statement-ignored.html)

J S

On error resume next statement ignored!
 
I have a macro procedure in a excel spreadsheet.

-----------------------------------------
Private Sub PrintAndCalculatePercentChanges(rownum)
On Error Resume Next

Cells(rownum, 9) = (Cells(rownum, 2) - Cells(rownum, 6)) / Cells(rownum,
6)

'If any error messages have occured then clear them
If Err < 0 Then
Err.Clear
End If
End Sub
-----------------------------------------

When this is executed on my computer, all errors in the procedure are
ignored. As they should be. However, when I run this procedure on another
computer. The macro halts on a divide zero error in this procedure!!! Which
means that for some reason the 'On error resume next' statement is being
ignored.

Is there any reason why this would be occuring? A missing referance or
something?

-J



Bob Phillips[_6_]

On error resume next statement ignored!
 
J,

Could it be that that computer has an option of 'Break on all errors'?

Check in the VBIDE, TooldOptions and on the General tab in the Error
Trapping section .

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

"J S" wrote in message
...
I have a macro procedure in a excel spreadsheet.

-----------------------------------------
Private Sub PrintAndCalculatePercentChanges(rownum)
On Error Resume Next

Cells(rownum, 9) = (Cells(rownum, 2) - Cells(rownum, 6)) /

Cells(rownum,
6)

'If any error messages have occured then clear them
If Err < 0 Then
Err.Clear
End If
End Sub
-----------------------------------------

When this is executed on my computer, all errors in the procedure are
ignored. As they should be. However, when I run this procedure on another
computer. The macro halts on a divide zero error in this procedure!!!

Which
means that for some reason the 'On error resume next' statement is being
ignored.

Is there any reason why this would be occuring? A missing referance or
something?

-J





Gord Dibben

On error resume next statement ignored!
 
If what Bob suggests is the case, you could add this to your Workbook_Open
code.

Application.SendKeys ("%TOVM%B-~"), True 'Sets Break on Errors to OFF

Reset it to False in BeforeClose code.

Gord Dibben Excel MVP


On Fri, 30 Jan 2004 22:25:24 -0000, "Bob Phillips"
wrote:

J,

Could it be that that computer has an option of 'Break on all errors'?

Check in the VBIDE, TooldOptions and on the General tab in the Error
Trapping section .




All times are GMT +1. The time now is 06:04 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com