View Single Post
 
Old 11-14-2020, 08:25 AM
gmaxey gmaxey is offline Windows 10 Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,598
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Perhaps a different approach. This works for your example:


Code:
Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Dim oCell As Cell
  For Each oCell In Selection.Tables(1).Range.Cells
    Set oRng = oCell.Range
    If Len(oCell.Range.Text) > 2 Then
      oRng.Collapse wdCollapseEnd
      oRng.Move wdCharacter, -1
      Do Until oRng.Characters.First.Previous Like "[A-Za-hj-uwyz.]"
        'the Roman numberals could be a problem but few words end in 'i, v or x"
        oRng.Select
        oRng.MoveStart wdCharacter, -1
      Loop
      oRng.HighlightColorIndex = wdBrightGreen 'or delete the range
    End If
  Next
lbl_Exit:
  Exit Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/

Last edited by gmaxey; 11-14-2020 at 04:23 PM.
Reply With Quote