|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
Have a challenging inquiry in Word tables cells, to flag me if a cell contains more than 1 value
OK pros, I've search and search and come out empty. I'm looking to do ''conditional formating'' in a Word table.
First, I've did a Find and Replace for all Important periods ( ==>end of sentences only) to put them in the color Red in a freaking long tables that has only 2 columns, but is close to 2 thousands of rows. Note ===> Just that script was challenging to find all the ways, the periods are not at the end of the sentences. But it's ok, I've done a long script. Not too familiar with casesNow my challenge is to Find the cells, that has more than 1 periods that are identified as Red color. I know I must do a count, and >1. I cannot find a script. And by the way, the two periods are not in a row. So I'm looking to have each sentence in a cell. So I'm looking for those that are more than 1 sentence in a cell. Any advice, where to look for such a script, if a script is doable. I have presently Word 365. I thank you in advance for any insights |
#2
|
||||
|
||||
Show us the code to identify your "important periods". It is probably easier to adapt that code than it is to run a second macro since the processing of every cell is where the big time hits are going to occur.
And post a sample document so we can see exactly what you are doing to tag the periods.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oTbl As Table Dim oCell As Cell Dim oRng As Range Dim lngCount As Long Set oTbl = ActiveDocument.Tables(1) For Each oCell In oTbl.Range.Cells lngCount = 0 Set oRng = oCell.Range With oRng.Find .Text = "." .Font.ColorIndex = wdRed Do While .Execute If Not oRng.InRange(oCell.Range) Then Exit Do lngCount = lngCount + 1 oRng.Collapse wdCollapseEnd If lngCount > 1 Then oCell.Range.HighlightColorIndex = wdBrightGreen Exit Do End If Loop End With Next oCell lbl_Exit: Exit Sub End Sub |
#4
|
||||
|
||||
Greg Maxey, that script works Thanks. It took a long time but still worked
OMG, I'm in a awwwwe how pro's can think of such scripts like this. I'm still novice I guess.
Thank you so much, Greg, I'm deeply grateful. Case solved |
#5
|
||||
|
||||
Hello Guessed (Andrew),
I was starting to translate my script, cause much of it was in French or Bilingual (Eng and French), but I saw Greg's script and tried it at once. But thank you to offer to help. That long script, would have been embarrasing to me to pro's like yourself, how long it is. But it does work. One day, I'll get the hang of it. Keep searching, and bought many books to help me. Thanks again Have a great evening all of you |
Tags |
background color, find, flag |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Pasting more than 4 cells into Word tables ignores cell divides | 2vbr | Word Tables | 0 | 09-21-2020 08:16 PM |
How to make gridlines in cells of tables in MS Word 2007 | pgrewal | Drawing and Graphics | 1 | 07-18-2014 11:12 PM |
Shading in Cells in Word Tables | Cindy | Word Tables | 1 | 01-04-2013 02:38 PM |
Word 2007 Tables - Shift cells backwards one place | bloodge1 | Word Tables | 3 | 08-28-2012 10:11 PM |
Copy table cell formatting across multiple cells / tables | pakistanray | Word Tables | 2 | 10-31-2011 08:07 AM |