Numbering cells vertically in Word 2007

G

Graham Mayor

Tables are filled left to right, but you can put anything you want in the
cells of a table. What exactly are you trying to achieve?

--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP


<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
S

Suzette

I'm having the same issue. I want to number the first column 1, 2, 3, 4 and
the second column 5, 6, 7, 8; not have then number 1-2, 3-4, etc. I can
achieve this by first numbering the first column and then numbering the
second column, and then selecting the numbers in the second column and
changing the start numbering value. But that is an aweful lot of steps to
achieve simple numbering. Any ideas?
Thanks, Suzette
 
G

Graham Mayor

It will always be complicated to number Word tables in any manner other than
that Word intends i.e. left to right. One way would be to insert sequence
SEQ fields in each cell with separate sequences for each column. You can do
this with a macro after you have created your table, but before filling it
e.g.as follows, which will number a table by column no matter how many rows
or columns.
http://www.gmayor.com/installing_macro.htm

Sub NumberCellsByColumn()
Dim oTable As Table
Dim oCell As Range
Dim sSeq As String
Dim i, j As Long
Set oTable = ActiveDocument.Tables(1)
For j = 1 To oTable.Rows.Count
For i = 1 To oTable.Columns.Count
If j = 1 Then
If i > 1 Then
sSeq = "Col" & i & " \r" & _
(oTable.Rows.Count * (i - 1) + 1)
Else
sSeq = "Col" & i
End If
Else
sSeq = "Col" & i
End If
Set oCell = oTable.Cell(j, i).Range
oCell.End = oCell.End - 1
oCell.Select
Selection.Fields.Add Selection.Range, _
wdFieldSequence, sSeq, False
Next i
Next j
End Sub
 
S

Suzette

Thanks, Graham! Have a great weekend, Suzette

Graham Mayor said:
It will always be complicated to number Word tables in any manner other than
that Word intends i.e. left to right. One way would be to insert sequence
SEQ fields in each cell with separate sequences for each column. You can do
this with a macro after you have created your table, but before filling it
e.g.as follows, which will number a table by column no matter how many rows
or columns.
http://www.gmayor.com/installing_macro.htm

Sub NumberCellsByColumn()
Dim oTable As Table
Dim oCell As Range
Dim sSeq As String
Dim i, j As Long
Set oTable = ActiveDocument.Tables(1)
For j = 1 To oTable.Rows.Count
For i = 1 To oTable.Columns.Count
If j = 1 Then
If i > 1 Then
sSeq = "Col" & i & " \r" & _
(oTable.Rows.Count * (i - 1) + 1)
Else
sSeq = "Col" & i
End If
Else
sSeq = "Col" & i
End If
Set oCell = oTable.Cell(j, i).Range
oCell.End = oCell.End - 1
oCell.Select
Selection.Fields.Add Selection.Range, _
wdFieldSequence, sSeq, False
Next i
Next j
End Sub
 

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