Quote:
Originally Posted by gmaxey
Code:
Sub ScratchMacro()
'A basic Word Macro coded by Gregory K. Maxey
Dim oTbl As Table
Dim lngIndex As Long
Set oTbl = Selection.Tables(1)
oTbl.Columns.Add
For lngIndex = 1 To oTbl.Rows.count
oTbl.Cell(lngIndex, oTbl.Columns.count).Range.Text = lngIndex
Next lngIndex
oTbl.Sort False, oTbl.Columns.count, , wdSortOrderDescending
oTbl.Columns(oTbl.Columns.count).Delete
End Sub
|
Greg
I'm astounded that so small a macro could accomplish the task. I'll certainly try it. Am I right to assume I start with the table "selected"?
But...
Before I saw this reply I was planning to ask you the question below; I'm still trying to learn how to do it manually as you suggested.
As it turns out I already have a blank column (the first one) on the left of the table I’m try to reverse. Can I just put the numbers in that column and then sort on it, and later just “clear contents” of that column to get it back to blank again? Or even delete the column once I’m done sorting and then add a new blank column?
I was able to select the column and get numbers in each cell, but was stuck on how to sort the table based on the numbers in column 1.
Sorry to seem (or BE) so dense.
RJ