Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.newusers
Sesquipedalian Sam Sesquipedalian Sam is offline
external usenet poster
 
Posts: 126
Default Simple way to number the rows in a table?

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?
  #2   Report Post  
Posted to microsoft.public.word.newusers
Doug Robbins - Word MVP Doug Robbins - Word MVP is offline
external usenet poster
 
Posts: 8,832
Default Simple way to number the rows in a table?

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
"Sesquipedalian Sam" wrote in message
...
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?


  #3   Report Post  
Posted to microsoft.public.word.newusers
Sesquipedalian Sam Sesquipedalian Sam is offline
external usenet poster
 
Posts: 126
Default Simple way to number the rows in a table?

On Sat, 25 Jul 2009 16:28:45 +1000, "Doug Robbins - Word MVP"
wrote:

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.
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Reverse table order/number rows jessim Tables 4 November 30th 07 03:55 PM
Arbitrary number of rows in a table Kev[_2_] Mailmerge 1 November 6th 07 07:33 PM
how can I count the number of rows in an existing table roberto-cruz Tables 2 September 30th 07 10:41 AM
Count number of rows in table PamKT Microsoft Word Help 6 August 30th 06 09:32 AM
Limiting number of table rows per page Aniseed Tables 3 November 7th 05 11:34 AM


All times are GMT +1. The time now is 09:55 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"