![]() |
#14
|
||||
|
||||
![]()
I would do this with string functions to get the relevant positions of the - and the = characters. I don't see how the find makes it faster.
Code:
Sub DupPara() Dim aRngPara As Range, aRng As Range, iEqual As Integer, iPlus As Integer Set aRngPara = Selection.Paragraphs(1).Range iEqual = InStr(aRngPara.Text, "=") iPlus = InStr(aRngPara.Text, "-") If iEqual > 0 Then Set aRng = ActiveDocument.Range(aRngPara.Start, aRngPara.Start + iEqual) aRngPara.InsertAfter vbCr aRngPara.Collapse Direction:=wdCollapseEnd aRngPara.MoveEnd Unit:=wdCharacter, Count:=-1 aRngPara.FormattedText = aRng.FormattedText aRngPara.Characters(iPlus).Text = "+" End If End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Marcia | Excel Programming | 4 | 08-12-2022 03:54 PM |
Select entire text and then de-select certain Headings? | tq94 | Word | 3 | 02-26-2022 03:47 AM |
Select text between 2 | yacov | Word VBA | 2 | 08-15-2021 10:16 PM |
![]() |
cosmicyes | Excel Programming | 1 | 07-09-2018 02:47 AM |
![]() |
aymanharake | Excel Programming | 3 | 02-18-2017 04:09 PM |