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  

Reverse table order/number rows



 
 
Thread Tools Display Modes
  #1  
Old November 29th, 2007, 07:04 PM posted to microsoft.public.word.tables
jessim
external usenet poster
 
Posts: 3
Default Reverse table order/number rows

How can I:

a) Reverse the order of a table

and

b) Automatically number each row?

Thanks,
Jess
  #2  
Old November 29th, 2007, 07:39 PM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Reverse table order/number rows

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


--
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

"jessim" wrote in message
...
How can I:

a) Reverse the order of a table

and

b) Automatically number each row?

Thanks,
Jess



  #3  
Old November 29th, 2007, 09:20 PM posted to microsoft.public.word.tables
jessim
external usenet poster
 
Posts: 3
Default Reverse table order/number rows

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"
wrote:
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

--
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

"jessim" wrote in message

...

How can I:


a) Reverse the order of a table


and


b) Automatically number each row?


Thanks,
Jess


  #4  
Old November 30th, 2007, 06:40 AM posted to microsoft.public.word.tables
Doug Robbins - Word MVP
external usenet poster
 
Posts: 8,239
Default Reverse table order/number rows

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

--
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

"jessim" wrote in message
...
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"
wrote:
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

--
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

"jessim" wrote in message

...

How can I:


a) Reverse the order of a table


and


b) Automatically number each row?


Thanks,
Jess




  #5  
Old November 30th, 2007, 03:55 PM posted to microsoft.public.word.tables
jessim
external usenet poster
 
Posts: 3
Default Reverse table order/number rows

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
 




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 11:18 AM.


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