View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Patrick Molloy[_2_] Patrick Molloy[_2_] is offline
external usenet poster
 
Posts: 1,298
Default On Error GoTo Question

on error pushes a return address onto the stack, this needs to be poped
before another on error can be set

he's your code, with the fix


Range(Cells(x - 1, 1), Cells(Last_Entity, 1)).Select
On Error GoTo error1
Selection.Find(What:="REVENUE").Activate
Rev_Top = ActiveCell.Row + 1
Selection.Find(What:="TOTAL REVENUE").Activate
Rev_Bottom = ActiveCell.Row - 1
No_Rev:
On Error GoTo error2
Selection.Find(What:="DEPT PROFIT").Activate
Profit_Top = ActiveCell.Row + 1
Selection.Find(What:="TOTAL DEPT PROFIT").Activate
Profit_Bottom = ActiveCell.Row - 1
No_Profit:
''' blah more code
Exit Sub
error1: Resume No_Rev
error2: Resume No_Profit
END SUB


"QuietMan" wrote:

Does anyone know why this will not go to No_Profit...1st error check works
fine but second gives me an error

Thanks

Range(Cells(x - 1, 1), Cells(Last_Entity, 1)).Select
On Error GoTo No_Rev
Selection.Find(What:="REVENUE").Activate
Rev_Top = ActiveCell.Row + 1
Selection.Find(What:="TOTAL REVENUE").Activate
Rev_Bottom = ActiveCell.Row - 1
No_Rev:
On Error GoTo No_Profit
Selection.Find(What:="DEPT PROFIT").Activate
Profit_Top = ActiveCell.Row + 1
Selection.Find(What:="TOTAL DEPT PROFIT").Activate
Profit_Bottom = ActiveCell.Row - 1
No_Profit:
--
Helping Is always a good thing