Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 05-25-2017, 08:44 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 Keeping just the rows with specific word (BUT KEEP THE TITLE)

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.
Attached Images
File Type: png example.PNG (62.8 KB, 21 views)
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 08:16 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