The Anchorage
Personal website of Gregory K. Maxey, Commander USN (Retired)
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!
This Microsoft Word Tips & Microsoft Word Help page provides a couple of macro solutions to apply reverse numbering to a selected list.
The text illustrated below provide an example list:
Select all list members including the final paragraph mark.
Tip: Displaying non-printing characters will make it easier to ensure that you included the last paragraph mark in your selection.
With the list members selected, execute the following VBA procedure:
Option Explicit Sub ReverseNumberList() Dim i As Long Dim listCount As Long Dim Numrange As Range Dim oTmpRng As Range Set Numrange = Selection.Range ActiveWindow.View.ShowFieldCodes = False Numrange.ParagraphFormat.TabStops.Add Position:=InchesToPoints(0.3) listCount = Numrange.Paragraphs.Count For i = 1 To listCount Set oTmpRng = Numrange.Paragraphs(i).Range If IsNumeric(oTmpRng.Characters(1)) Then On Error GoTo ErrHandler If InStr(oTmpRng.Fields(1).Code, "SEQ") > 0 Then oTmpRng.Fields(1).Delete oTmpRng.End = oTmpRng.Start + 2 oTmpRng.Delete End If End If Reentry: Set oTmpRng = Numrange.Paragraphs(i).Range oTmpRng.Collapse wdCollapseStart oTmpRng.InsertAfter "." & vbTab oTmpRng.End = oTmpRng.End - 2 If i = 1 Then Numrange.Fields.Add oTmpRng, wdFieldSequence, "ReverseList \r1", False Else Numrange.Fields.Add oTmpRng, wdFieldSequence, "ReverseList", False End If oTmpRng.End = oTmpRng.End + 1 Numrange.Fields.Add oTmpRng, wdFieldEmpty, , False oTmpRng.End = oTmpRng.End - 1 oTmpRng.InsertAfter Text:="=" & listCount + 1 & "-" With Numrange.Paragraphs(i) .LeftIndent = InchesToPoints(0.3) .FirstLineIndent = InchesToPoints(-0.3) End With Next i ActiveWindow.View.ShowFieldCodes = False ActiveDocument.Fields.Update Exit Sub ErrHandler: If Err.Number = 5941 Then Set oTmpRng = Nothing Resume Reentry Else MsgBox "Unknown error exiting this routine" End If End Sub
See: Installing Macros for instructions on how to set up and use the macros provided in this Microsoft Word Help & Microsoft Word Tips page.
The method employs a SEQ field nested in a formula field to calculate and display the correct reverse numbering.
The second method is much simpler but is not well suited for re-ordering a list. Again, with the list members selected, run the following VBA procedure:
Sub ReverseNumberListII() Dim Numrange As Range Dim numtable As Table Dim numcolumn As Column Dim tabwidth As Long Dim i As Long Set Numrange = Selection.Range Set numtable = Numrange.ConvertToTable(Separator:=vbCr) tabwidth = PointsToInches(numtable.Columns(1).Width) Set numcolumn = Numrange.Tables(1).Columns.Add(BeforeColumn:=numtable.Columns(1)) numcolumn.Width = InchesToPoints(0.5) numtable.Columns(2).Width = InchesToPoints(tabwidth - 0.5) For i = 1 To numcolumn.Cells.Count numcolumn.Cells(i).Range.InsertBefore (numcolumn.Cells.Count - i + 1) & "." Next i numtable.Borders.Enable = False lbl_Exit: Exit Sub End Sub
The method uses plain text numbering and a borderless table. The fine gridlines are shown only on the screen and can be toggled off with Tables>Hide Gridlines.
Note: Word MVP Cindy Meister provides a non-macro field solution to reverse numbering on her website at Reverse Numbering.
That's it! I hope you have found this tips page useful and informative.
The information, illustrations and code contained in my "Microsoft Word Tips" are provided free and without risk or obligation.
However, the work is mine. If you use it for commercial purposes or benefit from my efforts through income earned or time saved then a donation, however small, will help to ensure the continued availability of this resource.
If you would like to donate, please use the appropriate donate button to access PayPal. Thank you!