Hi, I have code to copy rows and paste into another tab and I have code to find rows that have a specific text string and delete it. What I want to do is combine them somehow to copy to another tab only rows that have the text string -Barrett Road in column B
Sub LoopCopy()
Dim shWO As Worksheet, shAss As Worksheet
Dim WOLastRow As Long, Iter As Long
Dim RngToCopy As Range, RngToPaste As Range
With ThisWorkbook
Set shWO = .Sheets("PL Raw data - Combined") 'Modify as necessary.
Set shAss = .Sheets("Test") 'Modify as necessary.
End With
'Get the row index of the last populated row in column A.
'Change accordingly if you want to use another column as basis.
'Two versions of getting the last row are provided.
' WOLastRow = shWO.Range("A2").End(xlDown).Row
WOLastRow = shWO.Range("A" & Rows.Count).End(xlUp).Row
For Iter = 2 To WOLastRow
Set RngToPaste = shAss.Range("A" & (Iter + 2))
With shWO
Set RngToCopy = Union(.Range("A" & Iter), .Range("P" & Iter & ":S" & Iter))
RngToCopy.Copy RngToPaste
End With
Next Iter
End Sub
Sub sbDelete_Rows_IF_Cell_Cntains_String_Text_Value()
Dim lRow As Long
Dim iCntr As Long
lRow = 100
For iCntr = lRow To 1 Step -1
If Cells(iCntr, 1) = "Barrett Road" Then
Rows(iCntr).Delete
End If
Next
End Sub
Thanks
Bookmarks