How do I get my error trapping to continue after it has caused an error. What happens is the error occurs, is goes to the correct trap, continues running but when there is another error, it does not trap it, it just gives the msgbox with the error. Here is the code.
VB Code:
Sub CheckMFGPartInSAP() Dim MFGNo, ZE, Sta, Item Dim SAPBook, LimaBook, CheckRow LimaBook = "Copy of D35 ENGINE ASSEMBLY SPARE PARTS MASTER MATRIX.xls" SAPBook = "SAP Dump.xls" Do Until ActiveCell = "" MFGNo = ActiveCell Item = ActiveCell.Row Workbooks(SAPBook).Activate On Error GoTo NotFound Range("K4:K3534").Find(MFGNo, , , , , xlNext).Activate CheckRow = ActiveCell.Row If Range("A" & ActiveCell.Row) = "" Then Range("A" & ActiveCell.Row) = Item Else Range("A" & ActiveCell.Row) = Range("A" & ActiveCell.Row) & "," & Item End If Range("K4:K3534").Find(MFGNo, ActiveCell, , , , xlNext).Activate Do Until ActiveCell.Row = CheckRow If Range("A" & ActiveCell.Row) = "" Then Range("A" & ActiveCell.Row) = Item Else Range("A" & ActiveCell.Row) = Range("A" & ActiveCell.Row) & "," & Item End If Range("K4:K3534").Find(MFGNo, ActiveCell, , , , xlNext).Activate Loop NotFound: 'MsgBox Err.Description & Chr(10) & Err.Number Err.Clear Workbooks(LimaBook).Activate ActiveCell.Offset(1, 0).Activate Loop End Sub




Reply With Quote