View Single Post
 
Old 02-27-2020, 05:55 AM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,105
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Why would they change? There is nothing to suggest that they are anything but text. If you want the numbers to change you need to replace them with automatic numbering or re-apply the numbers. The following macro will replace the numbers with automatic numbering
Code:
Sub RenumberTable()
Dim oTable As Table
Dim oRng As Range
Dim i As Integer
    Set oTable = Selection.Tables(1)
    For i = 1 To oTable.Rows.Count    'start at 2 if there is a header row
        Set oRng = oTable.Range.Rows(i).Cells(1).Range
        oRng.End = oRng.End - 1
        oRng.Fields.Add Range:=oRng, _
        Type:=wdFieldAutoNum, _
        Text:="\*Arabic", _
        PreserveFormatting:=False
    Next i
    ActiveWindow.View.ShowFieldCodes = False
    Set oTable = Nothing
    Set oRng = Nothing
End Sub
and the next macro will simply renumber the column
Code:
Sub RenumberTable2()
Dim oTable As Table
Dim oRng As Range
Dim i As Integer
    Set oTable = Selection.Tables(1)
    For i = 1 To oTable.Rows.Count    'start at 2 if there is a header row
        Set oRng = oTable.Range.Rows(i).Cells(1).Range
        oRng.End = oRng.End - 1
        oRng.Text = i & Chr(46)
    Next i
    ActiveWindow.View.ShowFieldCodes = False
    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
Reply With Quote