H
HamishMcT
Hi there,
If you can help me on what may seem like a trivial matter I would be
very much obliged - I am tearing my hair out!
I have a fairly simple formatting and sorting macro which handles a
specific error first time but the next time the same error appears in
the same module , it doesn't handle it at all!
On Error GoTo error1
Cells.Find(What:="1 total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
is the first error handler (the label error1: is at the end of the
module after exit sub...). This works fine - the code jumps over this
bit as "1 total does not exist.
However, later on in the code, for example, I need to find the same
situation again so I have produced exactly the same code
On Error GoTo error1
Cells.Find(What:="1 total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
This time it throws a run time error! Aaaargh.
If anybody can advise why this might be the case I would be very
grateful.
Thanks and regards
Hamish
If you can help me on what may seem like a trivial matter I would be
very much obliged - I am tearing my hair out!
I have a fairly simple formatting and sorting macro which handles a
specific error first time but the next time the same error appears in
the same module , it doesn't handle it at all!
On Error GoTo error1
Cells.Find(What:="1 total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
is the first error handler (the label error1: is at the end of the
module after exit sub...). This works fine - the code jumps over this
bit as "1 total does not exist.
However, later on in the code, for example, I need to find the same
situation again so I have produced exactly the same code
On Error GoTo error1
Cells.Find(What:="1 total", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByColumns,
SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
This time it throws a run time error! Aaaargh.
If anybody can advise why this might be the case I would be very
grateful.
Thanks and regards
Hamish