![]() |
|
#1
|
|||
|
|||
![]()
After deleting entire row, no sorting took place in serial numbers. Serial numbers remain same.
I deleted a row between these two rows: ![]() |
#2
|
||||
|
||||
![]()
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 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 |
#3
|
||||
|
||||
![]()
Well, if you'd used Word's automatic numbering, that wouldn't be an issue, as those update dynamically. And, if you used SEQ fields for the numbering, a simple print preview would update them. But, if you typed them manually, then you'll have to re-type them - or adopt one of the other methods...
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Kuzcomerlin | Mail Merge | 3 | 01-22-2020 02:12 PM |
![]() |
MarieHelp | Excel | 1 | 01-13-2017 12:59 AM |
Sorting a table by column using a button | lozza | Word VBA | 0 | 10-27-2016 07:37 AM |
![]() |
skbutler | Excel | 2 | 01-13-2015 05:06 PM |
sorting problem | gsrikanth | Excel | 4 | 02-16-2012 12:30 AM |