Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #4  
Old 01-03-2021, 06:27 AM
gmaxey gmaxey is offline need to find Windows 10 need to find Office 2016
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,636
gmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nicegmaxey is just really nice
Default

Karkey/eduzs


For Each Loops in VBA can start to bog down very quickly in long documents. Better to first find what you are looking for then apply processes:

Sub ScratchMacro()
'A basic Word macro coded by Greg Maxey
Dim oRng As Range
Set oRng = ActiveDocument.Range
oRng.InsertBefore vbCr
With oRng.Find
.Text = Chr(13) & "<"
While .Execute
oRng.Paragraphs(2).Range.HighlightColorIndex = wdBrightGreen
Wend
End With
ActiveDocument.Range.Paragraphs(1).Range.Delete
lbl_Exit:
Exit Sub

End Sub
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
need to find Range method Find can't find dates jmcsa3 Excel Programming 1 05-02-2020 06:56 AM
How do you use the find and replace tool to find dates and times in Excel 2013? Jules90 Excel 3 04-14-2020 07:40 PM
find IP in range / find number between numbers gn28 Excel 4 06-14-2015 03:46 PM
need to find Find what box in Find and replace limits the length of a search term Hoxton118 Word VBA 7 06-10-2014 05:05 AM
need to find Bad view when using Find and Find & Replace - Word places found string on top line paulkaye Word 4 12-06-2011 11:05 PM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:33 PM.


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