Champers
07-23-2009, 07:04 AM
Hi All,
I have created a number of tables in a word document which I have attached and the Macro below removes all blank rows in the first table on the first page where the first column is blank.
However I would like it to go through all tables on each page and remove all blank rows where the first column is blank.
Any help would be appreciated.
'Sub Remove_Blank_Rows()
'
' Remove_Blank_Rows Macro
'
'
Sub RemoveBlankRows()
Dim I As Integer
Dim bDeleted As Boolean
Redo:
bDeleted = False
For I = 1 To ActiveDocument.Tables(1).Rows.Count
ActiveDocument.Tables(1).Rows(I).Select
ActiveDocument.Tables(1).Rows(I).Cells(1).Select
If Selection.Text = Chr(13) & Chr(7) Then
ActiveDocument.Tables(1).Rows(I).Delete
bDeleted = True
Exit For
End If
Next
If bDeleted Then GoTo Redo
MsgBox "DONE!"
End Sub
Thanks
Champers
I have created a number of tables in a word document which I have attached and the Macro below removes all blank rows in the first table on the first page where the first column is blank.
However I would like it to go through all tables on each page and remove all blank rows where the first column is blank.
Any help would be appreciated.
'Sub Remove_Blank_Rows()
'
' Remove_Blank_Rows Macro
'
'
Sub RemoveBlankRows()
Dim I As Integer
Dim bDeleted As Boolean
Redo:
bDeleted = False
For I = 1 To ActiveDocument.Tables(1).Rows.Count
ActiveDocument.Tables(1).Rows(I).Select
ActiveDocument.Tables(1).Rows(I).Cells(1).Select
If Selection.Text = Chr(13) & Chr(7) Then
ActiveDocument.Tables(1).Rows(I).Delete
bDeleted = True
Exit For
End If
Next
If bDeleted Then GoTo Redo
MsgBox "DONE!"
End Sub
Thanks
Champers