Hello,
I am trying to create some if statements based around find method results. In essence, I am trying to find an exact term in sheet of data and then if it is found copy the data directly to the left of it as a variable and then post it on another sheet. If it doesn't find the exact term, I want it to go to the next term search.
Here is an example of what I have so far:
AttName = "Part Number:"
FindRoutine = Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If FindRoutine = True Then
ActiveCell.Offset(0, 1).Range("a1").Select
AttValue = ActiveCell.Value
Sheets("Reference Data").Select
Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(RowCount - 1, 0).Range("a1").Select
ActiveCell.Value = AttValue
Sheets("Web Query Data").Select
Application.Goto reference:="R2C1"
Else: End If
AttName = "Model Year:"
FindRoutine = Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If FindRoutine = True Then
ActiveCell.Offset(0, 1).Range("a1").Select
AttValue = ActiveCell.Value
Sheets("Reference Data").Select
Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(RowCount - 1, 0).Range("a1").Select
ActiveCell.Value = AttValue
Sheets("Web Query Data").Select
Application.Goto reference:="R2C1"
Else: End If
Ultimately I would want it to move from the "Part Number:" search to the "Model Year:" search if there were no results on the "Part Number:" search.
Anyone have an idea?
Thanks in advance!
I am trying to create some if statements based around find method results. In essence, I am trying to find an exact term in sheet of data and then if it is found copy the data directly to the left of it as a variable and then post it on another sheet. If it doesn't find the exact term, I want it to go to the next term search.
Here is an example of what I have so far:
AttName = "Part Number:"
FindRoutine = Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If FindRoutine = True Then
ActiveCell.Offset(0, 1).Range("a1").Select
AttValue = ActiveCell.Value
Sheets("Reference Data").Select
Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(RowCount - 1, 0).Range("a1").Select
ActiveCell.Value = AttValue
Sheets("Web Query Data").Select
Application.Goto reference:="R2C1"
Else: End If
AttName = "Model Year:"
FindRoutine = Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
If FindRoutine = True Then
ActiveCell.Offset(0, 1).Range("a1").Select
AttValue = ActiveCell.Value
Sheets("Reference Data").Select
Cells.Find(What:=AttName, After:=ActiveCell, LookIn:=xlFormulas, LookAt _
:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, MatchCase:= _
False, SearchFormat:=False).Activate
ActiveCell.Offset(RowCount - 1, 0).Range("a1").Select
ActiveCell.Value = AttValue
Sheets("Web Query Data").Select
Application.Goto reference:="R2C1"
Else: End If
Ultimately I would want it to move from the "Part Number:" search to the "Model Year:" search if there were no results on the "Part Number:" search.
Anyone have an idea?
Thanks in advance!