It does, if 'Info:' the only thing in the cell. You asked for a macro that works as follows
Quote:
Originally Posted by Mattc1978
What I'd really want is if the cell only contains "info:" then delete the/ remove the cell
|
I suspect you still have cells containing rather more than that (e.g. 'header' content before 'Info:', spaces, paragraph breaks, etc. after 'Info:'). Try the following macro, which combines both the text cleanup and row deletion - accommodating that 'extra' content:
Code:
Sub Demo()
Application.ScreenUpdating = False
With ActiveDocument.Range
With .Find
.ClearFormatting
.Replacement.ClearFormatting
.Format = False
.Forward = True
.Wrap = wdFindContinue
.Text = "[\[\]\*“”""""]"
.MatchWildcards = True
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
.Text = "Info[: ^s.^t^13]{1,}"
.Replacement.Text = ""
.Wrap = wdFindStop
End With
Do While .Find.Execute
If .Information(wdWithInTable) = True Then
If .End = .Cells(1).Range.End - 1 Then .Rows.Delete
End If
.Collapse wdCollapseEnd
Loop
End With
Application.ScreenUpdating = True
End Sub