View Single Post
  #4   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber
 
Posts: n/a
Default The tables are turned! Well... not yet.

Hi Cooz,

Is there a way to turn a Word table
so that its columns become rows and its
rows become columns? If yes... how?


yes and no,

simple only if the number of columns equals
the number of rows.
Otherwise you have to create a new table, based on the
data from the old table.

Rows x columns has always to be the same.

Fancy things like embedded tables,
split and merged cells, embedded objects etc.
would make it very difficult.

The principle for cells containing nothing but text
and regardless of formatting, is:

Sub Test0004()
Dim lCll As Long ' number of cells
Dim l As Long ' just a counter
lCll = ActiveDocument.Tables(1).Range.Cells.Count
' create an array representing all the cells
' from left to right for each row
ReDim aCell(1 To lCll) As String
For l = 1 To lCll
aCell(l) = ActiveDocument.Tables(1).Range.Cells(l).Range.Text
Next
' now you've got all text from all cells
' in a one dimensional array
' and can arrange the data as you please
End Sub

Theory only.
Get Excel to help you, as Suzanne recommended.

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"