![]() |
|
|
|
#1
|
|||
|
|||
|
Hi! It's quite simple:
Code:
Sub Move_Two_Lines_Down()
Dim Rng As range
Set Rng = selection.range
Application.ScreenUpdating = False
Do
With Rng.Find
.ClearFormatting
.Replacement.ClearFormatting
.text = "Keywords ^#"
.Forward = True
.Format = True
.Wrap = wdFindStop
.MatchWildcards = False
.Execute
If Rng.End > selection.range.End Then Exit Do
If .found Then
Rng.Paragraphs(1).range.Cut
Rng.Move unit:=wdParagraph, count:=2
Rng.Paste
Rng.Collapse wdCollapseEnd
Else: Exit Do
End If
End With
Loop
Application.ScreenUpdating = True
Set Rng = Nothing
End Sub
|
|
#2
|
||||
|
||||
|
Thank you very much, vivka! I guess it's like almost everything else in the world, it's easy if you know it!
I could for some reason not get ActiveDocument.range to work, but I added a Selection.WholeStory above the sub, and that worked. It's actually a part of a larger macro, but that didn't give me any problems, using WordBasic.StartOfDocument as the line under this part of the macro made it go without a hich.
|
|
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| 1st line of 4-line poem centrally aligned; how to get lines 2-4 to start at same location on page | Swarup | Word | 6 | 09-16-2022 11:07 AM |
I need a macro to move dangling words to a new line please
|
iNeedaMacroPlease | Word VBA | 2 | 11-27-2020 11:34 AM |
| How to move a line to another line that starts with a chain selected in the 1st one? | gloub | Word VBA | 24 | 03-19-2019 03:12 PM |
| Lock line so text does not move to next line | saundrals | Word | 2 | 06-19-2014 03:59 PM |
| Lines move between close and open | jsmath22 | PowerPoint | 0 | 12-15-2010 07:44 AM |