Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #2  
Old 09-19-2021, 03:06 AM
gmayor's Avatar
gmayor gmayor is offline to print tickets the owner must always be in the same row regardless of previous items Windows 10 to print tickets the owner must always be in the same row regardless of previous items Office 2019
Expert
 
Join Date: Aug 2014
Posts: 4,138
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

I suspect there is no simple way to address this during the merge, however should be simple enough to produce a macro to ensure there were the appropriate number of empty paragraphs in each cell to produce the required spacing after the merge.
The following macro assumes that there are twelve empty paragraphs and four populated paragraphs at the top of each cell (including 1 value below the coloured line). Merge to a new document and then run the macro.

Code:
Sub Macro1()
'Graham Mayor - https://www.gmayor.com - Last updated - 19 Sep 2021
Dim oTable As Table
Dim oCell As Cell
Dim oRng As Range, oLast As Range
Dim i As Long, j As Long, k As Long, m As Long

    For Each oTable In ActiveDocument.Tables
        For Each oCell In oTable.Range.Cells
            Set oRng = oCell.Range
            j = 0: m = 0
            For i = 1 To oRng.Paragraphs.Count
                If Len(oRng.Paragraphs(i).Range) > 2 Then
                    j = j + 1
                Else
                    m = m + 1
                End If
            Next i
Debug.Print j & vbTab & m
            If j > 4 And m = 12 Then
                For k = 5 To j
                    Set oLast = oRng.Paragraphs(oRng.Paragraphs.Count - 1).Range
                    oLast.Delete
                Next k
            End If
        Next oCell
    Next oTable
lbl_Exit:
    Set oTable = nothinh
    Set oCell = Nothing
    Set oRng = Nothing
    Set oLast = 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
 

Tags
anchor, merge



Similar Threads
Thread Thread Starter Forum Replies Last Post
to print tickets the owner must always be in the same row regardless of previous items creating tickets starting at 001 mab5119 Mail Merge 1 02-07-2018 06:51 PM
Change name of document owner when writing comments Mark Laslett Word 2 08-25-2015 01:03 PM
owner and delegate question for outlook 2013 tik0pek205 Outlook 0 12-17-2014 08:02 AM
tickets numbering frenchyinpaddyland Publisher 0 04-27-2012 01:02 PM
Sharing Calenders, How to delete a clander without an owner! HeyRobi Outlook 0 05-15-2007 09:58 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 07:53 AM.


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