View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Helmut Weber[_2_] Helmut Weber[_2_] is offline
external usenet poster
 
Posts: 45
Default Deleting blank rows / columns in a Word 2002 Table

Hi Renegade,

like that:

Sub Test456()
Dim oTbl As Table
Dim oRow As Row
Dim oClm As Column
Dim oCll As Cell
Dim LngT As Long
Set oTbl = ActiveDocument.Tables(1)
For Each oRow In oTbl.Rows
If Len(oRow.Range) = (oRow.Cells.Count * 2) + 2 Then
oRow.Delete
End If
Next
For Each oClm In oTbl.Columns
LngT = 0
For Each oCll In oClm.Cells
' as there is no column range
If Len(oCll.Range) 2 Then
Exit For ' for speed reasons only
End If
LngT = LngT + 2
Next
If LngT = oClm.Cells.Count * 2 Then
oClm.Delete
End If
Next
End Sub

--

Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Vista Small Business, Office XP