Sub TableEdit() ' Paul Beverley - Version 03.08.24 ' Edits items in the cells of some or all tables stripEnds = True stripThese = "^p^t., " addEmDash = True doTrack = False doHighlight = True myColour = wdGray25 myTrack = ActiveDocument.TrackRevisions If doTrack = False Then ActiveDocument.TrackRevisions = False stripThese = Replace(stripThese, "^p", vbCr) stripThese = Replace(stripThese, "^t", vbTab) If Selection.start = Selection.End Then Set workRange = ActiveDocument.Tables doTheLot = True Else Set workRange = Selection.Tables End If Set rng = ActiveDocument.Content For Each myTable In workRange For Each myCell In myTable.Range.Cells myText = Left(myCell.Range, Len(myCell.Range) - 2) newText = "" ' an em dash If addEmDash = True And Trim(myText) = "" Then newText = ChrW(8212): myText = "" If Trim(myText) = ChrW(8211) Then newText = ChrW(8212): myText = "" If Trim(myText) = "-" Then newText = ChrW(8212): myText = "" ' en dash with figures to minus sign If Left(myText, 1) = ChrW(8211) And Len(myText) > 1 Then newText = Replace(myText, ChrW(8211), ChrW(8722)): myText = "" End If ' hyphen to minus sign If Left(myText, 1) = "-" And Len(myText) > 2 Then newText = Replace(myText, "-", ChrW(8722)) End If ' space-hyphen to minus sign If Left(myText, 2) = " -" Then newText = Replace(myText, " -", ChrW(8722)) End If If newText > "" Then myCell.Range = newText If doHighlight = True Then ActiveDocument.TrackRevisions = False myCell.Range.HighlightColorIndex = myColour ActiveDocument.TrackRevisions = myTrack End If End If ' Now strip any trailing tabs or CRs If stripEnds = True Then Set rng = myCell.Range rng.MoveEnd , -1 rng.start = rng.End - 1 ' Strip odd unwanted characters Do While InStr(stripThese, rng.Text) > 0 rng.Delete DoEvents rng.MoveStart , -1 Loop End If If myCell.Range.Characters(1) = "." Then myCell.Range.InsertBefore "0" Next myCell Next myTable Beep ActiveDocument.TrackRevisions = myTrack End Sub