View Single Post
  #6   Report Post  
ykchanaed
 
Posts: n/a
Default numbering in table

Thanks a lot, Greg.
how about change this macro in a way that number the second column with
starting number start with the next number of the end of the previous column?

"Greg Maxey" wrote:

I think you have to go pretty far back in Word to get that feature. Maybe
Word97. You can't do it easily in Word2000 +. Here is a macro that will
apply that numbering format.

If you change row or column count you can simply run it again.

Sub NumberTableTopToBottomLeftToRight()
Dim oTable As Table
Dim seqNum As Long
Dim oRng As Range
Dim i As Integer
Dim j As Integer

seqNum = 1
Set oTable = Selection.Tables(1)

For i = 1 To oTable.Columns.Count
For j = 1 To oTable.Rows.Count
If IsNumeric(Left(oTable.Cell(j, i).Range, 1)) Then
Set oRng = oTable.Cell(j, i).Range
oRng.End = oRng.End - 1
oRng.MoveEndUntil Cset:=Chr$(9), Count:=wdBackward
oRng.Delete
End If
oTable.Cell(j, i).Range.InsertBefore seqNum & "." & vbTab
oTable.Cell(j, i).Range.Paragraphs(1).LeftIndent = InchesToPoints(0.25)
oTable.Cell(j, i).Range.Paragraphs(1).FirstLineIndent =
InchesToPoints(-0.25)
seqNum = seqNum + 1
Next
Next
End Sub

--
Greg Maxey/Word MVP
See:
http://gregmaxey.mvps.org/word_tips.htm
For some helpful tips using Word.

ykchanaed wrote:
in previous versions of Word, numbering inside table can be chosed
row by row , or column by column.
In 2003, this function can not be found. Numbering can only be
sideway, ie. 1st in top one, then 2nd in the next right cell, and so
on.
I want to chose numbering downwards first,ie. next downward cell in
the same column till the end, then the next column.
can anyone help, thanks?