MS Word >> Convert vertical table to horizontal?

by Ymxld2lzc21pdGg » Wed, 18 Apr 2007 21:28:00 GMT

I have a table that lists vertically and I want to convert that table to list
item horizontally.


MS Word >> Convert vertical table to horizontal?

by Suzanne S. Barnhill » Wed, 18 Apr 2007 21:40:03 GMT


Short of rotating the table itself, you can paste it into Excel using Edit |
Paste Special: Transpose, then copy/paste back to Word.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA
Word MVP FAQ site: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.



list




MS Word >> Convert vertical table to horizontal?

by Helmut Weber » Wed, 18 Apr 2007 23:43:37 GMT

Hi,

if you know how to get a macro to work,
you might try this one,
which works for simple tables, as far as I see.

Simple means, no split or merged cells,
no table containing other tables,
no table containing objects like pictures etc.

Sub TransposeTable()
Dim C As Long ' column
Dim R As Long ' row

Dim x As Long ' just a counter
Dim y As Long ' just a counter
Dim z As Long ' just a counter

Dim STempo As String
Dim sArr() As String

With Selection
.Collapse
If Not .Information(wdWithInTable) Then
MsgBox "insertion point not in table"
Exit Sub
End If

With .Tables(1)
C = .Columns.Count
R = .Rows.Count
If R * C <> .Range.Cells.Count Then
MsgBox "split or merged cells"
Exit Sub
End If
ReDim sArr(1 To .Range.Cells.Count)
For x = 1 To UBound(sArr)
STempo = .Range.Cells(x).Range.Text
STempo = Left(STempo, (Len(STempo) - 2))
sArr(x) = STempo
Next
' --------------------------
With .Columns
For x = 1 To R - C
.Add
Next
For x = 1 To C - R
.Last.Delete
Next
End With
' --------------------------
With .Rows
For x = 1 To R - C
.Last.Delete
Next
For x = 1 To C - R
.Add
Next
End With
'--------------------------
' Transpose
'--------------------------
C = .Columns.Count
R = .Rows.Count
x = 0
For y = 1 To C
For z = 1 To R
x = x + 1
.Cell(z, y).Range.Text = sArr(x)
Next
Next
End With
End With

End Sub

HTH nevertheless

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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


Similar Threads

1. Table problems with mixed vertical and horizontal text

I've been assigned to make a Word table to look EXACTLY like an
AutoCAD table for text input.  This is a 5 column table on landscape
11 x 17 paper.  The first 4 columns are normal text that will be
formatted in outline form.  The last one is a narrow column, divided
into 8 rows with vertical text inside them.  One of the rows is
further divided into 3 columns on the left side and two on the right
with lines separated by tiny spaces (additional columns to define
space?) for input of initials and a date.  So this looks like a
vertical table inside the cell.    Wish I could post a picture.

I've tried everything from a nested table to hand-drawing the
divisions in this further divided row and still make it fit into a
slightly less than 1-inch space.  Every little tweak results in a
major change in the rest of the table. I've turned off word wrap and
auto fit to contents. I've tried using the ruler line to drag the row
height and setting the height in Table Properties.   Isn't there a way
to drag a table line and increase/decrease JUST that cell size?  Or a
way to auto fit this little table into my 1-inch space?

I'm ready to give up and my boss won't be happy.  Please help!

2. Missing Vertical and Horizontal Scroll Bars & Page View/Layout View buttons

3. Word Doc Vertical page to Horizontal page?

Version: 2008
Operating System: Mac OS X 10.5 (Leopard)
Processor: Intel

Putting together a word document, most of the pages are vertical but would like to have one page horizontal for a chart. Can do on PC but not on this Mac using Office 2008. Any ideas please?

4. VBA editor windows: horizontal vs vertical

5. mouse scroll changes from vertical to horizontal

In word 2003 and excel 2003 my mouse will change from scrolling vertically 
using the scroll wheet to horizontal.  In word, this usually happens when I'm 
working on a document that is a large table in landscape mode.  The table can 
be from 10 - 40 pages.  In excel, it happens in an invoice that I receive 
each month from an outside vendor.  This months invoice had over 34,000 rows. 
 For some reason, as I'm working on these documents the mouse will switch 
from vertical scrolling to horizontal scrolling.  The only way I've been able 
to get around this is to save the document and reopen it.  It will then work 
correctly but the problem will happen again.  Is there any setting in office 
that I can check?  Is there another way to change the scrolling back to 
veritical without having to save, close and reopen the documents?

6. Cut and Paste formatting Vertical to Horizontal in Excel - Microsoft Office

7. how do i change the lay out of a text from vertical to horizontal

i'm trying to get my text to print from vertical to horizontal not sure how 
to perform the task

8. How to make horizontal and vertical lines - Microsoft Office