Macro's Stopping


Posted by David on July 21, 2000 1:01 AM

Has anyone evr experienced a macro just stopping in the middle of the code. No errors or warnings just stopping for no reason. I have tried steeping throught the code and it still stops at the same place. If I save the file and run it again it usually works but it is verrryyyy annoying. Please help. I am going crazy. I know it is not pretty but it should work (I think).

Sub ScrapReconcile()
'
'
Dim ITemp As Integer
Dim daythere As Boolean
'-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
tempr = Worksheets("Sheet2").Range("j15").Value
IBad = Worksheets("Sheet2").Range("e15").Value
IDate = Worksheets("Sheet2").Range("g4").Value

Sheets("Totals").Visible = True
Worksheets("Totals").Select
daythere = False
ICounter = 11
Do While daythere = False
Cells(ICounter, 1).Select
If (Worksheets("Totals").Cells(ICounter, 1) = IDate) Then
Worksheets("Totals").Cells(ICounter, 6 + tempr).Value = Cells(ICounter, 6 + tempr) + IBad
daythere = True
End If
ICounter = ICounter + 1
If ICounter = 200 Then
Call ERRORCODE(3)
Exit Sub
End If
Loop
Worksheets("Sheet2").Range("h10") = Worksheets("Sheet2").Range("h10") - Worksheets("Sheet2").Range("e15") 'code stops running after this line
Worksheets("Sheet2").Range("e15") = 0
Worksheets("Sheet2").Select
If Worksheets("Sheet2").Cells(10, 8) = 0 Then
Call ERRORCODE(0)
End If
Sheets("Totals").Visible = False
Call CHECKSCRAP
If Worksheets("Sheet2").Range("h10") = 0 Then
Worksheets("Sheet2").Select
Cells(2, 7).Select
Else
Worksheets("Sheet2").Select
Cells(15, 5).Select
End If
End Sub



Posted by Ada on July 21, 0100 1:20 AM

David
Can't see anything wrong with the code. Where does it stop?
What code do you have for ERRORCODE and CHECKSCRAP?
Ada