Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #12  
Old 01-30-2024, 09:46 AM
vivka vivka is offline select until = Windows 7 64bit select until = Office 2016
Expert
 
Join Date: Jul 2023
Posts: 302
vivka is on a distinguished road
Default

Yes, Greg, your code is quite interesting! I tried to avoid the selection but couldn't. I've only added two short lines to your code (without them it didn't fulfill its task):
Code:
Sub Test_Macro()
'Copy a range from the current para's start till after "=" and
'paste it after the para.

Dim oRng As range

  Set oRng = selection.Paragraphs(1).range
  oRng.Copy
  selection.Find.ClearFormatting
  selection.Find.Replacement.ClearFormatting
  With oRng.Find
    .text = "="
    .Forward = True
    .Wrap = wdFindStop
    .Format = False
    If .Execute Then
      oRng.InsertAfter vbCr
      oRng.Paragraphs(1).Next.range.FormattedText = oRng.Paragraphs(1).range.FormattedText
      oRng.Paragraphs(1).range.PasteAndFormat (wdFormatOriginalFormatting)
    End If
  End With
lbl_Exit:
  Exit Sub
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
select until = Select until last row 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
select until = Select a row in a different tab cosmicyes Excel Programming 1 07-09-2018 02:47 AM
select until = How to select row aymanharake Excel Programming 3 02-18-2017 04:09 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:12 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft