Log in

View Full Version : Delete row within bookmarked table



DavG63
05-25-2017, 09:15 AM
Hi

This is a very quick question.

I have a three column, eight row column which I've bookmarked "B1". I'm looking to delete out a row in the table if the the first column in each row is blank.

I can't get it to work and I don't know why. Can anyone point me in the right direction?

Thanks

Dav

gmaxey
05-25-2017, 01:48 PM
Since you haven't posted any code its easy to say that no code usually won't work.


Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oTbl As Table, oRow As Row
Dim lngIndex As Long
Set oTbl = ActiveDocument.Bookmarks("B1").Range.Tables(1)
For lngIndex = oTbl.Rows.Count To 1 Step -1
Set oRow = oTbl.Rows(lngIndex)
If Len(oRow.Cells(1).Range) = 2 Then oRow.Delete
Next
lbl_Exit:
Exit Sub
End Sub