(Sorry for double posting, my bad).
I just noticed why this was not working in the original document:
In the beggining, the word that I want to search is "08/05/2017"
When it comes to the last table, if there is this date written anywhere inside the table, this line will be executed:
Quote:
For Each aRow In aTbl.Rows
If Not InStr(aRow.Range.Text, sText) > 0 Then
aRow.Range.Font.Hidden = True
Else
Set aCell = aRow.Cells(aRow.Cells.Count)
sRefs = sRefs & "|" & Split(aCell.Range.Text, vbCr)(0) 'builds a list of all the wanted refs
End If
Next aRow
|
So when it goes to the last table, every line is hidden (beside the ones with the "08/05/2017")
I'm trying to fix that. Maybe we can do something to check always if the text "08/05/2017" is in the second column (aRow, 2) of each table. That is because the important rows to keep in this table is just if the date (the word that I'm searching) inside the second column named as "Inicio Previsto" (that means Expected Start") matchs.
EDIT:
I just got it done adding this line to show the last table again:
Quote:
With ActiveDocument.Tables(ActiveDocument.Tables.Count) 'Beside this With I added the line below:
ActiveDocument.Range.Font.Hidden = False
|
But now my code is a little bit redundant. When it goes to the last table, first it hides everything, then it shows everything again and finally starts to hide the rows that will not be used. Can we do this in a better way?