Word: Delete Table Row if Column B is Empty

Discussion in 'Word Tables' started by cepes, Dec 1, 2009.

  1. cepes

    cepes Guest

    I have a Word table with labels in Column A and merged data in Column B.

    I need to add VBA so that if Column B is empty, the entire row is deleted.



    Word 2007
    cepes, Dec 1, 2009
    1. Advertisements

  2. Use the following:

    Dim i As Long
    With Selection.Tables(1)
    For i = .Rows.Count To 1 Step -1
    If Len(.Cell(i, 2).Range.Text) = 2 Then
    End If
    Next i
    End With

    Hope this helps,

    Doug Robbins - Word MVP

    Please reply only to the newsgroups unless you wish to obtain my services on
    a paid professional basis.
    Doug Robbins - Word MVP, Dec 2, 2009
    1. Advertisements

  3. What if you have multiple Tables?

    David Schenkler, Aug 20, 2012
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.