![]() |
|
#8
|
||||
|
||||
|
To run the last macro I posted on all tables just add the loop around the code e.g.
Code:
Sub Macro1()
Dim vList As Variant
Dim oTable As Table
Dim oCell As cell
Dim i As Long
Dim oRng As Range
Dim sText As String
Dim bOmit As Boolean
vList = Array("Goodwill", "Income", "Net Cost", "A") 'The words to ignore when they appear to the left of the '/' character.
For Each oTable In ActiveDocument.Tables
With oTable
For Each oCell In oTable.Range.Cells
Set oRng = oCell.Range
oRng.Case = wdTitleWord
If InStr(1, oRng.Text, "/") > 0 Then
sText = Split(oRng.Text, "/")(0)
If IsNumeric(sText) = False Then
bOmit = False
For i = 0 To UBound(vList)
If CStr(vList(i)) = sText Then
bOmit = True
Exit For
End If
Next i
If bOmit = False Then
oRng.Text = Trim(Split(oRng.Text, "/")(1))
End If
End If
End If
Next oCell
End With
Next oTable
Set oTable = Nothing
Set oRng = Nothing
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019) Visit my web site for more programming tips and ready made processes www.gmayor.com |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Removal of resource calendars? | Snoboy | Project | 0 | 10-07-2020 12:28 PM |
Removal first 7 typos
|
Chetan Seebra | Excel Programming | 2 | 03-31-2015 12:57 PM |
table removal syntax
|
EAGLE SEU | Word VBA | 5 | 01-23-2015 10:57 AM |
Field removal from template
|
Phelony | Word | 1 | 10-18-2011 03:28 AM |