View Single Post
 
Old 10-10-2016, 08:57 PM
gmayor's Avatar
gmayor gmayor is offline Windows 10 Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,137
gmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud ofgmayor has much to be proud of
Default

Based on that information
Code:
Sub RemoveZeroValues()
Dim oTable As Table
Dim oCell As Range
Dim lngCount As Long
    If Not Selection.Information(wdWithInTable) Then
        MsgBox "Put the cursor in the table and run the macro again"
        GoTo lbl_Exit
    End If
    Set oTable = Selection.Tables(1)
    For lngCount = oTable.Rows.Count To 2 Step -1
        Set oCell = oTable.Rows(lngCount).Cells(2).Range
        oCell.End = oCell.End - 1
        If val(oCell.Text) = 0 Then oTable.Rows(lngCount).Delete
    Next lngCount
lbl_Exit:
    Set oTable = Nothing
    Set oCell = Nothing
    Exit Sub
End Sub
__________________
Graham Mayor - MS MVP (Word) (2002-2019)
Visit my web site for more programming tips and ready made processes www.gmayor.com
Reply With Quote