Delete all rows of a table that contain a particular text string in the first column

Article contributed by Bill Coan

Sub DeleteRows()

Dim TargetText As String
Dim oRow As Row

If Selection.Information(wdWithInTable) = False Then Exit Sub

TargetText = InputBox$("Enter target text:", "Delete Rows")

For Each oRow In Selection.Tables(1).Rows
    If oRow.Cells(1).Range.Text = TargetText & vbCr & Chr(7) Then oRow.Delete
Next oRow

End Sub