View Single Post
  #3   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber
 
Posts: n/a
Default Sorting Text In Table

Hi Tiffany,

without even trying to handle merged cells,
without nested tables and
without cells containing anything but text,

and assuming you know something about macros,
then, if the insertion point is in a table,
in principle:

Sub SortRows()
Dim r As Long ' rows
Dim c As Long ' columns
Dim oTbl As Table
Dim oRow As Row
Dim oArr() As String
Set oTbl = Selection.Tables(1)
For r = 1 To oTbl.Rows.Count
oArr = Split(oTbl.Rows(r).Range, chr(13) & chr(7))
WordBasic.sortarray oArr
For c = 2 To UBound(oArr)
' MsgBox c - 1 & " = [" & oArr(c) & "]"
oTbl.Rows(r).Cells(c - 1).Range.Text = oArr(c)
Next
Next
End Sub


--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

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