View Single Post
 
Old 05-21-2014, 09:44 AM
gmaxey gmaxey is offline Windows 7 32bit Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,428
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

On second thought this might be better. This way you can use non-uniform tables:

Code:
Sub ScratchMacro()
Dim oTbl As Word.Table, oTblTarget As Table
Dim arrIndex() As Long
Dim lngIndex As Long
Dim oRng As Word.Range
  Set oTbl = ActiveDocument.Tables(1)
  oTbl.Range.Copy
  Set oRng = ActiveDocument.Bookmarks("bmRows").Range
  If oRng.Tables.Count = 1 Then
    oRng.Tables(1).Delete
  End If
  oRng.Paste
  Set oTblTarget = oRng.Tables(1)
  ActiveDocument.Bookmarks.Add "bmRows", oTblTarget.Range
  ReDim arrIndex(0)
  For lngIndex = oTbl.Rows.Count To 1 Step -1
    If Not Left(oTbl.Cell(lngIndex, 1).Range.Text, Len(oTbl.Cell(lngIndex, 1).Range.Text) - 2) = "High" Then
      arrIndex(UBound(arrIndex)) = oTbl.Rows(lngIndex).Index
      ReDim Preserve arrIndex(UBound(arrIndex) + 1)
    End If
  Next lngIndex
  For lngIndex = 0 To UBound(arrIndex) - 1
    oTblTarget.Rows(arrIndex(lngIndex)).Delete
  Next lngIndex
End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote