![]() |
|
|||||||
|
|
|
Thread Tools | Display Modes |
|
|
|
#1
|
||||
|
||||
|
I'm going to assume that you have a regular table (no merged cells) and at least 2 columns and the code should be comparing the words in the first cell with all other cells on that row (like the original email). If these assumptions are correct then this modification to Paul's very elegant code should work.
Code:
Sub Demo()
Application.ScreenUpdating = False
Dim Tbl As Table, Rng As Range, strTxt As String, i As Long, j As Long
Options.DefaultHighlightColorIndex = wdYellow
For Each Tbl In ActiveDocument.Tables
With Tbl
For i = 1 To .Rows.Count
Set Rng = .Rows(i).Range
Rng.Start = .Cell(i, 2).Range.Start
With .Cell(i, 1).Range
For j = 1 To .Words.Count
strTxt = Trim(.Words(j))
With Rng.Find
.ClearFormatting
.Text = strTxt
With .Replacement
.ClearFormatting
.Highlight = True
.Text = "^&"
End With
.Format = True
.Forward = True
.MatchCase = False
.MatchWholeWord = True
.MatchWildcards = False
.Wrap = wdFindStop
.Execute Replace:=wdReplaceAll
End With
Next
End With
Next
End With
Next
Application.ScreenUpdating = True
End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
#2
|
||||
|
||||
|
I hope one day, I'll get it, understand better. Well been better since day 1 in Word, 5 years ago. OK let me test it
|
|
#3
|
||||
|
||||
|
I'm so sorry, I forgotten that I had removed the option of showing highlights. Because others in the same document, uses a software where there's different colors of highlighted stuff. I get too confused, so I had removed it. I totally forgotten.
So you are right, it works. I truly am sorry. You did an amazing job. I'll try to analyze it when I'll have more time. again, humble appologies |
|
| Tags |
| duplicate in tables, help please, highlight cells |
| Thread Tools | |
| Display Modes | |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Need Help to Script to align all the tables only as of a section to end of doc? | Cendrinne | Word VBA | 4 | 04-05-2021 11:37 AM |
| Can Excel find Duplicate entries when only part of the cell's data is a duplicate of another cell? | jsisley | Excel | 1 | 07-21-2017 09:20 AM |
VBA Table – Search All Tables - Find & Replace Text in Table Cell With Specific Background Color
|
jc491 | Word VBA | 8 | 09-30-2015 06:10 AM |
| Script starts nesting tables without reason | selman555 | Word VBA | 1 | 10-17-2014 01:01 AM |
| Pivot Table Duplicate Data | cnw | Excel | 0 | 08-31-2012 08:24 AM |