Hi,
I was unable to open the spreadsheet you attached, but I think I was able to make a sample one and write a macro to do what you were looking for based on the description. The code to do what you listed is shown below. I have attached the *.xls file that includes the macro. Press "<CTRL> a" to run the macro on the data shown on Sheet1. Hit "<CTRL> z" to reset the data on Sheet1.
Hope this helps,
Daniel
Sub FindString()
Dim LastRow As Long
Dim i As Long
Dim j As Long
Dim WKScol As String
Dim LCDcol As String
Sheets(1).Select
WKScol = "F"
LCDcol = "G"
' Set LastRow
Selection.SpecialCells(xlCellTypeLastCell).Select
LastRow = ActiveCell.Row
' find "TAR-WKS" or "TAR_LCD", add row and transfer data
For i = LastRow To 1 Step -1
' < For "TAR-WKS" >
If (InStr(Range("H" & i), "TAR-WKS") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(WKScol & j) = Range("H" & i)
GoTo 10
ElseIf (InStr(Range("I" & i), "TAR-WKS") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(WKScol & j) = Range("I" & i)
GoTo 10
ElseIf (InStr(Range("J" & i), "TAR-WKS") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(WKScol & j) = Range("J" & i)
GoTo 10
ElseIf (InStr(Range("K" & i), "TAR-WKS") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(WKScol & j) = Range("K" & i)
GoTo 10
' < For "TAR_LCD" >
ElseIf (InStr(Range("H" & i), "TAR_LCD") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(LCDcol & j) = Range("H" & i)
GoTo 10
ElseIf (InStr(Range("I" & i), "TAR_LCD") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(LCDcol & j) = Range("I" & i)
GoTo 10
ElseIf (InStr(Range("J" & i), "TAR_LCD") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(LCDcol & j) = Range("J" & i)
GoTo 10
ElseIf (InStr(Range("K" & i), "TAR_LCD") > 0) Then
j = i + 1
Rows(j).Select
Selection.Insert Shift:=xlDown
Range(LCDcol & j) = Range("K" & i)
GoTo 10
Else
GoTo 20
End If
' Copy Columns "A" to "E"
10 Range("A" & i & ":E" & i).Copy
Range("A" & j).Select
ActiveSheet.Paste
Application.CutCopyMode = False
20 Next i
Range("A1").Select
End Sub
Bookmarks