Home |
Search |
Today's Posts |
#1
![]() |
|||
|
|||
![]()
Hi,
I have found this macro which is working, but not entirely as I want. I have large document (on average with 500 pages) in which I have to delete every row in tables that have in second column no value. Document is made using Mail Merge, so I have table on 1 page, than on 3, 6, 8,... So far is macro deleting all empty columns in one table in which is cursor, but it will not delete empty columns in all other tables. Public Sub DeleteEmptyColums() Dim Table As Table, Row As Range, Cell As Cell, Counter As Long, _ NumRows As Long, TextInRow As Boolean ' Specify which table you want to work on. For Each Table In ActiveDocument.Tables ' Set a range variable to the first row's range Set Row = Table.Rows(1).Range NumRows = Table.Rows.Count Application.ScreenUpdating = False For Counter = 1 To NumRows StatusBar = "Row " & Counter TextInRow = False With Selection.Tables(1) For i = .Rows.Count To 1 Step -1 If Len(.Cell(i, 2).Range.Text) = 2 Then .Rows(i).Delete End If Next i End With Next Counter Next Table Application.ScreenUpdating = True End Sub Could somebody help me. Kind regards, Rok |
Reply |
Thread Tools | |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Word: Delete Table Row if Column B is Empty | Tables | |||
Delete Word table with macro | Microsoft Word Help | |||
How to delete empty page after table | Tables | |||
Macros:How to select a specific column of a table and format it using macro? | Tables | |||
Colums Disapear when I save as a Web Page, but I want Colums. | Page Layout |