P
Peruanos72
I have the following code (the code repeats about 12 times searching for a
different name each time) and if the name being searched is not found then I
get a runtime error 91. I want the code to run everytime but if the item is
not found then I want the macro to continue to a specified line and continue
with the next search.
Thanks in advance for any help on this.
Sub Update_Non_Blue()
'
' find Macro
' Macro recorded 2/4/2009 by rblakeman
'
'
Range("A5").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("A1").Select
Cells.find(What:="ASHELTON", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
On Error GoTo 26
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents
Range("A1").Select
Cells.find(What:="BAHOUST", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents
Range("A1").Select
Cells.find(What:="CDMCNEAL", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents
different name each time) and if the name being searched is not found then I
get a runtime error 91. I want the code to run everytime but if the item is
not found then I want the macro to continue to a specified line and continue
with the next search.
Thanks in advance for any help on this.
Sub Update_Non_Blue()
'
' find Macro
' Macro recorded 2/4/2009 by rblakeman
'
'
Range("A5").Select
Selection.QueryTable.Refresh BackgroundQuery:=False
Range("A1").Select
Cells.find(What:="ASHELTON", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
On Error GoTo 26
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents
Range("A1").Select
Cells.find(What:="BAHOUST", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents
Range("A1").Select
Cells.find(What:="CDMCNEAL", After:=ActiveCell, LookIn:=xlFormulas, _
LookAt:=xlPart, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
MatchCase:=False, SearchFormat:=False).Activate
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveSheet.Paste
Application.CutCopyMode = False
Selection.FillDown
ActiveCell.Select
Selection.ClearContents