Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / November 2007

Tip: Looking for answers? Try searching our database.

Reverse table order/number rows

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
jessim - 29 Nov 2007 19:04 GMT
How can I:

a) Reverse the order of a table

and

b) Automatically number each row?

Thanks,
Jess
Doug Robbins - Word MVP - 29 Nov 2007 19:39 GMT
Use a macro containing the following code

Dim i As Long
With Selection.Tables(1)
   .Columns.Add beforecolumn:=.Columns(1)
   For i = 2 To .Rows.Count
       .Cell(i, 1).Range.Text = i - 1
   Next i
   .SortDescending
End With

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> How can I:
>
[quoted text clipped - 6 lines]
> Thanks,
> Jess
jessim - 29 Nov 2007 21:20 GMT
Hi Doug,

The macro works great!  Just one little problem: after it ran, the
rows are now numbered descendingly 84-1 instead of 1-84 (84 rows in my
table, natch).  Is there a way to just reverse that 1 numbering column
alone?

Thanks again,
Jess

On Nov 29, 2:39 pm, "Doug Robbins - Word MVP"
<d...@REMOVECAPSmvps.org> wrote:
> Use a macro containing the following code
>
[quoted text clipped - 25 lines]
> > Thanks,
> > Jess
Doug Robbins - Word MVP - 30 Nov 2007 06:40 GMT
Use

Dim i As Long
With Selection.Tables(1)
   .Columns.Add beforecolumn:=.Columns(1)
   For i = 2 To .Rows.Count
       .Cell(i, 1).Range.Text = .Rows.Count - i + 1
   Next i
   .SortAscending
End With

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Hi Doug,
>
[quoted text clipped - 37 lines]
>> > Thanks,
>> > Jess
jessim - 30 Nov 2007 15:55 GMT
I think it's more due to my unfamiliarity with how macros work that I
just ended up accidentally deleting/fudging around with them.  After
they ran, my tables ended up looking funny, so I did a workaround by
copy-and-pasting the first column to another document and reversing it
there, then pasting it back.  Otherwise, the macros worked great and
did their job :-)

Thanks a lot,
Jess
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.