![]() |
|
#8
|
||||
|
||||
|
Quote:
******************************* So part 1 = Find & Replace the values below in tables, and put them in blue: Code:
Application.ScreenUpdating = False
Dim aTbl As Table
For Each aTbl In ActiveDocument.Tables
With aTbl.range.Find
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "[$]{1}[0-9,.]{1;}"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "[$\(]{2}[0-9,.]{1;}"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "([0-9]{1;})"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "([0-9,.]{2;})"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "([\(][0-9]{1;}[\)])"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "([\(][0-9,.]{2;}[\)])"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "(^=){1}"
.Replacement.Text = "\1"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "([\)])([\)])"
.Replacement.Text = "\2"
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End With
'Next
Next aTbl
Part 2, If found text in Blue in tables, then Delete Code:
Application.ScreenUpdating = False
Dim aTbl As Table
For Each aTbl In ActiveDocument.Tables
With aTbl.range.Find
Selection.Find.ClearFormatting
Selection.Find.Font.Color = wdColorBlue
Selection.Find.Replacement.ClearFormatting
'Selection.Find.Replacement.Font.Color = wdColorBlue
With Selection.Find
.Format = True
.Forward = True
.Wrap = wdFindStop
.MatchWildcards = True
.Text = "?"
.Replacement.Text = ""
.Execute Replace:=wdReplaceAll
End With
Selection.Find.Execute Replace:=wdReplaceAll
Selection.Find.ClearFormatting
Selection.Find.Replacement.ClearFormatting
With Selection.Find
.Text = ""
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindStop
.Format = False
.MatchCase = False
.MatchWildcards = False
End With
Selection.Find.Execute Replace:=wdReplaceAll
End With
'Next
Next aTbl
Please know that I dont have programming skills YET, but I manage with what I know. I'm sure it could be improved, but since you wanted to see my scripts, here they are ![]() Cendrinne |
| Tags |
| cells, helpme, wildcards |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
Splitting Tables containing Merged Cells
|
bpike | Word VBA | 7 | 10-28-2020 02:23 AM |
How do I run code on all cells in all tables?
|
wido | Word VBA | 2 | 09-04-2019 05:32 AM |
Can I repeat or self-populate cells/tables?
|
pvh | PowerPoint | 6 | 05-05-2015 03:21 PM |
| Tables in Powerpoint - Hiding Cells | manisfeld | PowerPoint | 2 | 06-08-2014 08:17 PM |
| Shading in Cells in Word Tables | Cindy | Word Tables | 1 | 01-04-2013 02:38 PM |