Please consider the macro below. I'm stumped as to how to perform an initial total line count, then do the math (see notations). I'm then stumped how to code a proper For In Do lopp in VBA for the second section. Thanks!
' Macro should initially perform the following math:
' Total loop iterations = (total line count / 2) + 1
'
' VariousArtists2 Macro
' Macro recorded 1/12/2006 by cmorton
' The initial series comprises up to 40 sets of two lines each.
' For each set, insert line 2 into line 1 just prior to the '.',
' then separate the org. line 1 and line 2 data with a {sp}-{sp}
'
Selection.MoveDown Unit:=wdLine, Count:=1
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Cut
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = "."
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeBackspace
Selection.TypeText Text:=" -"
'
' End of first set manipulation
' Process remaining sets
' For In Do loop (using Total iterations var)
'
Selection.MoveDown Unit:=wdLine, Count:=2
Selection.HomeKey Unit:=wdLine
Selection.EndKey Unit:=wdLine, Extend:=wdExtend
Selection.Cut
Selection.MoveUp Unit:=wdLine, Count:=1
Selection.Find.ClearFormatting
With Selection.Find
.Text = "."
End With
Selection.Find.Execute
Selection.MoveLeft Unit:=wdCharacter, Count:=1
Selection.TypeText Text:=" "
Selection.PasteAndFormat (wdPasteDefault)
Selection.TypeBackspace
Selection.MoveRight Unit:=wdCharacter, Count:=1, Extend:=wdExtend
Selection.TypeBackspace
Selection.TypeText Text:=" -"
'
' Next
'
End Sub



