I have a macro which identifies a place using a key text ('BX') in the document , and the next one below it. It establishes two placeholders ('First' and 'Next') , and then deletes the text between.
The only problem is it only works for the first instance of the key text , but then stops.
Can someone suggest a way to modify it so it runs through to the bottom of the document and finds all examples , and not just the first?
![]()
Sub Macro8() ' ' Macro8 Macro ' Selection.Find.ClearFormatting With Selection.Find .Text = "BX" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Selection.EndKey Unit:=wdLine Selection.TypeText Text:="First" Selection.Find.ClearFormatting With Selection.Find .Text = "BX" .Replacement.Text = "" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Selection.HomeKey Unit:=wdLine Selection.MoveUp Unit:=wdLine, Count:=1 Selection.TypeText Text:="Next" Selection.MoveUp Unit:=wdScreen, Count:=8 Selection.Find.ClearFormatting Selection.Find.Replacement.ClearFormatting With Selection.Find .Text = "First*Next" .Replacement.Text = "^p^p" .Forward = True .Wrap = wdFindContinue .Format = False .MatchCase = False .MatchWholeWord = False .MatchAllWordForms = False .MatchSoundsLike = False .MatchWildcards = True End With Selection.Find.Execute Replace:=wdReplaceAll End Sub
Grateful for any advice.
![]()
Bookmarks