Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 11-03-2020, 09:45 PM
gmayor's Avatar
gmayor gmayor is offline Remove row in word table if one cell is blank Windows 10 Remove row in word table if one cell is blank Office 2016
Expert
 
Join Date: Aug 2014
Posts: 4,144
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

The following macro will delete the unwanted rows in the example document:
Code:
Sub Macro1()
'Graham Mayor - https://www.gmayor.com - Last updated - 04 Nov 2020
Dim oTable As Table
Dim i As Integer, j As Integer
    For j = ActiveDocument.Tables.Count To 1 Step -1
        Set oTable = ActiveDocument.Tables(j)
        For i = oTable.Rows.Count To 1 Step -1
            oTable.Rows(i).Select
            If Len(oTable.Rows(i).Range) <= 6 Then
                oTable.Rows(i).Delete
            End If
        Next i
        If oTable.Rows.Last.Cells.Count = 4 Then
            oTable.Rows.Last.Delete
        End If
    Next j
    Set oTable = Nothing
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
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
Remove row in word table if one cell is blank How to remove almost a full page of blank space in between Word table rows garrisonsdad Word Tables 4 10-18-2018 09:09 PM
Remove row in word table if one cell is blank Remove blank table rows AFTER mailmerge Formd Mail Merge 5 05-11-2018 03:43 PM
Remove row in word table if one cell is blank How to remove blank spaces between rows in a table, Jamal NUMAN Word 2 04-28-2017 12:59 PM
Remove any pivot table fields with a blank entry Ramtrap Excel Programming 0 04-14-2017 07:00 AM
how to remove blank box on top-left corner of table in PPT 2010? dylansmith PowerPoint 3 10-18-2012 03:59 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 09:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft