View Single Post
 
Old 02-10-2019, 03:48 PM
Guessed's Avatar
Guessed Guessed is online now Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,451
Guessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud ofGuessed has much to be proud of
Default

The basic code is as follows.
Code:
Sub wiperows()
  Dim i As Integer
  With Selection.Tables(1)
    For i = .Rows.Count To 1 Step -1
      If Len(.Rows(i).Cells(1).Range.Text) = 2 Then .Rows(i).Delete
    Next i
  End With
End Sub
You may need to complicate it further to deal with errors you might encounter such as:
- the user hasn't put their cursor in the table before running the macro
- there are vertically merged cells which confuses Word when it is looking for a 'row'
__________________
Andrew Lockton
Chrysalis Design, Melbourne Australia
Reply With Quote