A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

Word 2003



 
 
Thread Tools Display Modes
  #1  
Old January 12th, 2010, 02:21 PM posted to microsoft.public.word.tables
Enterprise Teacher
external usenet poster
 
Posts: 1
Default Word 2003

I have started a new job and been given an existing Word doc which has a
number of rows and columns. I want to use the info which has been put into
one of the columns but then use this info as a row in a new doc, i.e.,
instead of the info in the cells reading down the LHS of the page, they
become the heading row in a new doc. Can I do this easily or do I have to
laboriously cut and paste each cell? Thanks
  #2  
Old January 12th, 2010, 04:25 PM posted to microsoft.public.word.tables
Graham Mayor
external usenet poster
 
Posts: 18,297
Default Word 2003

What you ask is fairly simple to achieve with a macro. The following will
work with any simple table regardless of the number of columns/rows. -
http://www.gmayor.com/installing_macro.htm . Select the column you want to
copy at the prompt. A new document is created with a new table with as many
columns as there are rows, with the column content as the row header as
requested.

Dim oTable As Table
Dim oTargetTable As Table
Dim oRng As Range
Dim iCol As Integer
Dim oTarget As Document
Set oTable = Selection.Tables(1)
Set oTarget = Documents.Add
Set oTargetTable = oTarget.Tables.Add(oTarget.Range, _
1, oTable.Rows.Count)
iCol = InputBox("Copy which column? 1 to " & oTable.Columns.Count)
For i = 1 To oTable.Rows.Count
Set oRng = oTable.Cell(i, iCol).Range
oRng.End = oRng.End - 1
oTargetTable.Cell(1, i).Range.Text = oRng.Text
Next i


--

Graham Mayor - Word MVP

My web site www.gmayor.com
Word MVP web site http://word.mvps.org


"Enterprise Teacher" Enterprise wrote in
message ...
I have started a new job and been given an existing Word doc which has a
number of rows and columns. I want to use the info which has been put into
one of the columns but then use this info as a row in a new doc, i.e.,
instead of the info in the cells reading down the LHS of the page, they
become the heading row in a new doc. Can I do this easily or do I have to
laboriously cut and paste each cell? Thanks



 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 10:46 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.