View Single Post
 
Old 11-06-2023, 12:29 PM
vivka vivka is offline Windows 7 64bit Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Hi, RobiNew! The following macro skips one-liners clusters if their first para is center-aligned or has a digit:
Code:
Sub OneLiners()
'In selection, replace Chr(13) with Chr(11) between all
'consecutive one-line paras, if....

Dim oRng
Application.ScreenUpdating = False
Set oRng = ActiveDocument.range
    For Each Para In oRng.Paragraphs
        If Para.range.End >= oRng.End Then Exit Sub
        If Para.range.ParagraphFormat.Alignment = wdAlignParagraphCenter _
            Or Para.range Like "*[0-9]*" Then GoTo nexxt
        If Para.range.ComputeStatistics(wdStatisticLines) = 1 Then
            Do While Para.Next.range.ComputeStatistics(wdStatisticLines) = 1
                Para.range.Characters.Last.text = Chr(11)
            Loop
        End If
nexxt:
    Next
Application.ScreenUpdating = True
Set oRng = Nothing
End Sub
If you want to see if other paras meet the requirements, place the If statement in other place (experiment with it).
Reply With Quote