Hello,
I have a lot of tables containing data in a pattern like this:
- A table that is the title of a company
- Below that, a table containing the data of this company
(I'm attatching an image showing this)
I have to keep just the rows that contains a specific word (in this example is "10/05/2017") and ALSO the table above (which is the title).
My idea was to paint in red the entire row that contains the specified word and then delete everything that is not painted in red. After that, I was planning to exclude eveything that is not painted in red. The problem is when I do that I'm not painting the title.
I tried this in many ways, I can't figure how to do that. This is what I struggling for now:
Quote:
Sub DeleteRowWithSpecifiedText()
Dim sText As String
sText = InputBox("Insert text to paint")
Selection.Find.ClearFormatting
With Selection.Find
.Text = sText
.Wrap = wdFindContinue
End With
Do While Selection.Find.Execute
If Selection.Information(wdWithInTable) Then
Selection.Rows.Shading.ForegroundPatternColor = wdColorRed
End If
Loop
End Sub
|
But this fail to:
Paint the entire row
Do not paint the title of the companys
I don't know how to exclude the rest of the rows.
If anyone can help me, please tell me a way to do that. I can't figure how.