View Single Post
 
Old 02-10-2019, 03:48 PM
Guessed's Avatar
Guessed Guessed is offline Windows 10 Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,969
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
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