![]() |
|
#1
|
||||
|
||||
![]() The macro in the quoted post is for deleting rows where the last column contains only a 0; not for deleting blank rows. To delete rows that are entirely empty, you would use code like: Code:
Sub MailMergeToDoc() Application.ScreenUpdating = False Dim Tbl As Table, r As Long ActiveDocument.MailMerge.Execute With ActiveDocument For Each Tbl In .Tables With Tbl For r = .Rows.Count To 2 Step -1 With .Rows(r) If Len(.Range.Text) = 2 * .Cells.Count + 2 Then .Delete End With Next End With Next End With Application.ScreenUpdating = False End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#2
|
|||
|
|||
![]()
Thank you Paul - to confirm, will this macro run when I use the finish and merge option in the main mail merge (macro enabled doc? I have attached the letter template for info.
Any help appreciated. Ged |
#3
|
||||
|
||||
![]()
Yes, it will. Whether you'll get the desired results, though, depends on what's on the rows concerned when there's no data; I suspect your empty 'Invoice Date' and 'Due Date' fields will output dates like 1 Jan 1900, in which case a different macro will be needed.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
![]() |
Thread Tools | |
Display Modes | |
|
![]() |
||||
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 |
![]() |
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 |
![]() |
sieler | Word | 3 | 04-12-2009 01:38 PM |