Delete row when 2 column has no value
Hi,
I have found this macro which is working, but not entirely as I want.
I need that macro go through every table in document - now it only works in one table.
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.
Set Table = Selection.Tables(1)
' Set a range variable to the first row's range
Set Row = Table.Rows(1).Range
NumRows = Table.Rows.Count
' Next Table
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
Application.ScreenUpdating = True
End Sub
Any ideas?
|