Microsoft Office Forums Removing Lines / Tables with Blank Data

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #31  
Old 05-31-2019, 12:21 AM
macropod's Avatar
macropod macropod is offline Removing Lines / Tables with Blank Data Windows 7 64bit Removing Lines / Tables with Blank Data Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,535
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default


Your document's structure hardly makes deleting these empty 'sections' easy. They aren't separate tables. Rather, they're just rows with different shadings within the same table. So, basically, what a macro would have to do is first go through deleting empty rows as it now does, then go through the table again work out whether there are any PSP/DBP/RSP rows left for each year and, if not, delete the year details.
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
  #32  
Old 06-03-2019, 12:36 AM
Crosby87 Crosby87 is offline Removing Lines / Tables with Blank Data Windows 7 64bit Removing Lines / Tables with Blank Data Office 2013
Novice
Removing Lines / Tables with Blank Data
 
Join Date: May 2018
Posts: 16
Crosby87 is on a distinguished road
Default

Is it possible to do or would it be easier to try and re-create the whole document and create a new macro?
Reply With Quote
  #33  
Old 07-11-2019, 05:12 AM
Crosby87 Crosby87 is offline Removing Lines / Tables with Blank Data Windows 7 64bit Removing Lines / Tables with Blank Data Office 2013
Novice
Removing Lines / Tables with Blank Data
 
Join Date: May 2018
Posts: 16
Crosby87 is on a distinguished road
Default

Quote:
Originally Posted by macropod View Post
What do you mean by 'delete that whole section'?
Hi Paul,

I have re-made the Word document and everything now is in a seperate table but the format looks the same as before.

As discussed before is there away to remove the tables (or lines in the table) if there is no value showing

I.E if there were no awards under number of shares granted in 2016 it woudl remove that whole table or if there were just lines under one of the years i.e say DBP - the reference to PSP and RSP would be deleted?

Regards

Craig
Attached Files
File Type: docx Template 2.0 Total Rem 11072019.docx (23.1 KB, 1 views)
Reply With Quote
  #34  
Old 07-16-2019, 02:24 AM
macropod's Avatar
macropod macropod is offline Removing Lines / Tables with Blank Data Windows 7 64bit Removing Lines / Tables with Blank Data Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 19,535
macropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to beholdmacropod is a splendid one to behold
Default

Try:
Code:
Sub MailMergeToDoc()
Application.ScreenUpdating = False
Dim t As Long, r As Long, bDel As Boolean
ActiveDocument.MailMerge.Execute
With ActiveDocument
  For t = .Tables.Count To 1 Step -1
    With .Tables(t)
      If Split(.Cell(1, 1).Range.Text, vbCr)(0) Like "#### Awards (Vesting ####)" Then
        bDel = True
        For r = .Rows.Count - 1 To 2 Step -1
          If Trim(Split(.Cell(r, 1).Range.Text, vbCr)(0)) Like "[DPR][BS]P Award" Then
            If Split(.Cell(r, 4).Range.Text, vbCr)(0) <> "" Then
              bDel = False
            Else
              .Rows(r).Delete
            End If
          End If
        Next
      If bDel = True Then .Delete
      End If
    End With
  Next
End With
Application.ScreenUpdating = False
End Sub
__________________
Cheers,
Paul Edstein
[MS MVP - Word]
Reply With Quote
Reply

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
how to delete every blank and non-numeric rows without removing the header enuff Excel 3 08-24-2017 05:56 AM
Removing blank pages at the end of a document Xanzia Word 3 06-01-2014 11:13 AM
Removing Lines / Tables with Blank Data Getting blank lines instead of supressed lines. Welshie82 Mail Merge 2 11-14-2011 01:41 AM
Urgent help needed with removing blank lines... iammom2four Outlook 0 12-15-2010 06:12 AM
Removing Lines / Tables with Blank Data How to turn all blank lines into non-blank for legal forms sieler Word 3 04-12-2009 01:38 PM


All times are GMT -7. The time now is 01:07 PM.


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