I am trying to use a find statement that looks in column A for a certain number. If it does find the number, then the program then executes and continues on. If it does not find that number then I want to use another find statement to find another number. This goes on for a few numbers. Code is shown below.
If the program does not find the condition, normally I would get an error message, so to override that I put the Onerror goto ... It seems to me that in the one subroutine you cannot have more than one Onerror goto statement. Is that correct?
Is there a better way to handle error overiding so that the progam does not stop.
This is part of the program:
On Error GoTo 35
Cells.Find(What:="575", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
35 On Error GoTo 36
Cells.Find(What:="576", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
36 On Error GoTo 40
Cells.Find(What:="577", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
GoTo 40
40 end sub
If the program does not find the condition, normally I would get an error message, so to override that I put the Onerror goto ... It seems to me that in the one subroutine you cannot have more than one Onerror goto statement. Is that correct?
Is there a better way to handle error overiding so that the progam does not stop.
This is part of the program:
On Error GoTo 35
Cells.Find(What:="575", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
35 On Error GoTo 36
Cells.Find(What:="576", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
36 On Error GoTo 40
Cells.Find(What:="577", After:=ActiveCell, LookIn:=xlValues, LookAt:= _
xlPart, SearchOrder:=xlByColumns, SearchDirection:=xlNext, MatchCase:=True, _
SearchFormat:=False).Activate
Call SubHSelect
Call HPaste
GoTo 40
40 end sub