Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.tables
Renegade Renegade is offline
external usenet poster
 
Posts: 5
Default Deleting blank rows / columns in a Word 2002 Table

Does anyone know a quick method or have a macro written to delete blank rows
and/or columns contained in a Word 2002 Table. Please share, I would be most
grateful. Thank you in advance for any replies.
  #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
Reply
Thread Tools
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to lock columns/rows in a table in word Mamma Boel Tables 7 May 11th 23 08:49 AM
Deleting rows or columns Rufus Tables 2 July 28th 07 12:42 AM
Deleting Multiple Blank Rows (which feature two lines) in a Word D dalovindj Microsoft Word Help 0 July 10th 06 06:43 PM
Deleting Blank Rows in Word [email protected] Mailmerge 1 July 4th 05 08:40 PM
Deleting blank rows in all tables KWC via OfficeKB.com Tables 2 June 24th 05 05:33 PM


All times are GMT +1. The time now is 11:43 PM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"