Sub CopyPaste2()
Dim WS As Worksheet
Dim rcnt As Long
rcnt = Sheets("Sheet1").Range("A" & Rows.Count).End(xlUp).Row
Sheets("Sheet1").Range("A1:E" & rcnt).Select
Selection.Copy
Set WS = Sheets.Add
ActiveSheet.Name = "Test" 'renames the sheet2 to test
ActiveSheet.Paste 'pastes the copied data
Call substringdelete
End Sub
Sub substringdelete()
Dim rcnt As Long, col As Integer
rcnt = ActiveSheet.Range("A" & Rows.Count).End(xlUp).Row
col = 3
For i = 2 To rcnt
While ActiveSheet.Cells(i, col).Value <> ""
If InStr(1, ActiveSheet.Cells(i, col).Value, "good morning") > 0 Then
ActiveSheet.Rows(i & ":" & i).Delete
End If
col = col + 1
Wend
col = 3
Next
End Sub
Bookmarks