View Single Post
 
Old 10-19-2015, 05:21 AM
Charles Kenyon Charles Kenyon is offline Windows 8 Office 2013
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,464
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

This cannot be done with a field, automatic numbering is sequential by design; vba would be required.

In Excel I accomplished this by a cell at the bottom of the column that has the ID numbers which says MAX of the column +1. I then use a macro to insert a new row above the current one and put the value found in the bookmark for the formula in the ID column for the new row.

Here is the vba code to assign the new number to column Q of the new row:
Code:
'   Insert new row above selection
'
    
    Dim lRow As Long
    lRow = Selection.Row
    Selection.EntireRow.Insert
'
'   Assign Case Number
'
    Dim lNext As Long
    
    lNext = Range("Next_Number").Value
    
    Cells(lRow, "Q").Value = lNext
The cell with the MAX formula has the label "Next_Number."

I prefer using Excel for data rather than Word and wouldn't know how to get the MAX function to work in Word. I'm sure that something could be done using vba.
Reply With Quote