View Single Post
 
Old 10-27-2020, 09:35 PM
macropod's Avatar
macropod macropod is offline Windows 10 Office 2010
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,467
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Alternatively:
Code:
Sub SplitTables()
Application.ScreenUpdating = False
Const StrFnd As String = "Tree Number"
With ActiveDocument.Range
  With .Find
    .ClearFormatting
    .Replacement.ClearFormatting
    .Text = StrFnd
    .Replacement.Text = ""
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    .MatchCase = True
  End With
  Do While .Find.Execute
    If .Information(wdWithInTable) = True Then
      With .Cells(1)
        If .RowIndex > 1 Then
          If Split(.Range.Text, vbCr)(0) = StrFnd Then .Range.InsertBreak (wdColumnBreak)
        End If
      End With
    End If
    .Collapse wdCollapseEnd
  Loop
End With
Application.ScreenUpdating = True
End Sub
This should also be faster than looping through all cells in all tables.
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote