Simple way to number the rows in a table?

S

Sesquipedalian Sam

I have a document containing descriptions of parts. Each part section
contains a tables with a row for each sub-part. There are hundreds of
parts and each part has up to 10-15 sub-part.

I would like to number the rows in each table to use as
automatically-generated sub-part numbers.

I found several articles on the Internet that suggest using a numbered
list. One example is:

http://blogs.techrepublic.com.com/msoffice/?p=487

The problem with that approach is I have to manually restart the
numbering in each table, such as if I copy a table (as a template) for
a new table.

Another problem it the tab character that Word inserts after the list
number.

Is there a way to get each table to automatically restart numebring at
"1" (after the header row) and replace the tab character with a single
space?

If not, is there another way?
 
D

Doug Robbins - Word MVP

Run a macro containing the following code:

Dim i As Long
Dim atable As Table
For Each atable In ActiveDocument.Tables
With atable
For i = 1 To .Rows.Count
.Cell(i, 1).Range.Text = i
Next i
End With
Next atable

If you want the numbering to start in the second row of each table, use

Dim i As Long
Dim atable As Table
For Each atable In ActiveDocument.Tables
With atable
For i = 2 To .Rows.Count
.Cell(i, 1).Range.Text = i - 1
Next i
End With
Next atable


--
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
 
S

Sesquipedalian Sam

Run a macro containing the following code:

Dim i As Long
Dim atable As Table
For Each atable In ActiveDocument.Tables
With atable
For i = 1 To .Rows.Count
.Cell(i, 1).Range.Text = i
Next i
End With
Next atable

If you want the numbering to start in the second row of each table, use

Dim i As Long
Dim atable As Table
For Each atable In ActiveDocument.Tables
With atable
For i = 2 To .Rows.Count
.Cell(i, 1).Range.Text = i - 1
Next i
End With
Next atable

Thank you.
 

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