unique numbering prefix required for tables

J

Jane

I have a Requirements Specification template with a number of different
tables. Some tables require numbering for the rows with a specific style eg
in the Business Rules tables users can click a button to apply/renumber all
rows with the style of BusRule. Each number requires a specified prefix eg
MR23-001, MR23-002 etc

(The reason for this is that at some stage the numbering will be "locked
down" as testers start using them so any additional business rules that need
to be inserted in the table are assigned the next number in the series
regardless of where it is inserted - so numbering may go 001, 002, 015, 003,
004 etc)

This was all working beautifully as the originally required numbering was
sequential throughout the entire document. I had a DocVariable set up for
the prefix which the user could update through a dialog box if required and
that prefix was applied to all the numbers.

This has now changed in that the sequential numbering ONLY applies to the
current table and that table must have a unique prefix for the number. I am
unsure of how to store/hold the prefix for each of the tables. I was
thinking that the easiest way may be to just include the required prefix in
the table heading somewhere eg [MR23] .

Any suggestions?

tks
Jane
 
D

Doug Robbins - Word MVP

I would use a macro containing the following code to create the numbers in a
table. Before the document is finally locked down, you would just run it
again if a row was inserted or deleted and it would re-insert the numbers.

The macro asks you for the prefix to be used for that table and then inserts
numbers into the cells of the first column of the table with that prefix
followed by a hyphen and then numbers in the format 001, 002, 003, etc.
starting with the second row of the table.

Dim i As Long
Dim prefix As String
prefix = InputBox("Enter the prefix to be used for this table.")
With Selection.Tables(1)
For i = 2 To .Rows.Count
.Cell(i, 1).Range.Text = prefix & "-" & Format(i - 1, "000")
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com
 
J

Jane

Thank you Doug. I could not seem to get access to any postings on this site
on Monday so managed to potter along on my own :)

I decided to go with having the prefix included in the Header of the colum
in the format [XXX99] for a few reasons rather than prompt for the prefix to
be entered each time.

I also have the macro rippling through the table to find the greatest
assigned number and allocate the next one in the series to the row where the
cursor is positioned (providing it has no number already and is the correct
style). This I will use after the document is "locked down"

Jane

Doug Robbins - Word MVP said:
I would use a macro containing the following code to create the numbers in a
table. Before the document is finally locked down, you would just run it
again if a row was inserted or deleted and it would re-insert the numbers.

The macro asks you for the prefix to be used for that table and then inserts
numbers into the cells of the first column of the table with that prefix
followed by a hyphen and then numbers in the format 001, 002, 003, etc.
starting with the second row of the table.

Dim i As Long
Dim prefix As String
prefix = InputBox("Enter the prefix to be used for this table.")
With Selection.Tables(1)
For i = 2 To .Rows.Count
.Cell(i, 1).Range.Text = prefix & "-" & Format(i - 1, "000")
Next i
End With


--
Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP, originally posted via msnews.microsoft.com

Jane said:
I have a Requirements Specification template with a number of different
tables. Some tables require numbering for the rows with a specific style
eg
in the Business Rules tables users can click a button to apply/renumber
all
rows with the style of BusRule. Each number requires a specified prefix
eg
MR23-001, MR23-002 etc

(The reason for this is that at some stage the numbering will be "locked
down" as testers start using them so any additional business rules that
need
to be inserted in the table are assigned the next number in the series
regardless of where it is inserted - so numbering may go 001, 002, 015,
003,
004 etc)

This was all working beautifully as the originally required numbering was
sequential throughout the entire document. I had a DocVariable set up for
the prefix which the user could update through a dialog box if required
and
that prefix was applied to all the numbers.

This has now changed in that the sequential numbering ONLY applies to the
current table and that table must have a unique prefix for the number. I
am
unsure of how to store/hold the prefix for each of the tables. I was
thinking that the easiest way may be to just include the required prefix
in
the table heading somewhere eg [MR23] .

Any suggestions?

tks
Jane

.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top