View Single Post
 
Old 05-06-2013, 01:27 PM
So New2 This So New2 This is offline Windows XP Office 2007
Novice
 
Join Date: May 2013
Location: Cleveland,OH
Posts: 3
So New2 This is on a distinguished road
Default Delete table if cell has data

I've used this code to delete a table if a cell was empty, but now I need to do the opposite, that is delete the table if a cell contains data.
Code:
Public Sub SHUNT()
Dim oRng1 As Range
With ActiveDocument
  Set oRng1 = .Range(Start:=.Bookmarks("BK_SHUNTS").Range.End, End:=.Bookmarks("BK_SHUNTE").Range.Start)
  If Len(oRng1.Tables(1).Cell(1, 1).Range) = 2 Then
    oRng1.Tables(1).Delete
    GoTo finish
  Else
    Dim t1 As Table
    Set t1 = ActiveDocument.Bookmarks("BK_SHUNT").Range.Tables(1)
  End If
End With
finish:
End Sub
Thank you

Last edited by macropod; 05-06-2013 at 08:56 PM. Reason: Added code tags & formatting
Reply With Quote