Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #11  
Old 05-28-2017, 10:26 AM
Kopko Kopko is offline Keeping just the rows with specific word (BUT KEEP THE TITLE) Windows 10 Keeping just the rows with specific word (BUT KEEP THE TITLE) Office 2013
Novice
Keeping just the rows with specific word (BUT KEEP THE TITLE)
 
Join Date: May 2017
Posts: 12
Kopko is on a distinguished road
Default

(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?
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Open file which contains specific words in title Nick70 PowerPoint 2 06-08-2016 06:55 AM
Keeping just the rows with specific word (BUT KEEP THE TITLE) Formatting all tables in doc with specific word in title jeffreybrown Word VBA 2 05-01-2016 06:05 PM
Copying specific columns of a table to WORD and deleting rows ffinley Word VBA 5 12-07-2015 04:01 PM
Export calendar events from multiple calendars with specific title rasmus Outlook 0 02-06-2015 01:58 AM
Extracting specific rows sbdk82 Excel 4 09-07-2014 10:24 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 05:47 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft