Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-13-2016, 10:04 AM
Marrick13 Marrick13 is offline Macro to find and format with whole word match option Windows XP Macro to find and format with whole word match option Office 2010 32bit
Competent Performer
Macro to find and format with whole word match option
 
Join Date: Jun 2006
Posts: 102
Marrick13 will become famous soon enough
Default Macro to find and format with whole word match option

I am trying to improve a macro that searches for a string in a user-defined range in Excel that provides the option of matching whole words in the search. (I want the match whole word search to look for a search term that does NOT have a letter or number immediately before or after it and therefore interpret that as a whole word match.)

I have several macros I’ve been working on in the attached (destined for a userform which I will set up after I get the code to work as intended).

The ‘Find_and_Highlight3’ macro works exactly as I want it to – it finds all instances of the search with both case sensitive and insensitive options and formats by size, bold, and text color. I ran it using a font size of 16, bold, and the font color of red (and case insensitive). It found and formatted every occurrence of “test”. The only thing that’s missing is the option to search by whole word matches. That’s why it formats the ‘testT” in 'Avicenna writesThe Book of Healing and The Canon of Medicine’. I want to have a match whole word user option that would ignore such an instance.



‘Find_and_Highlight4’ is my attempt to incorporate a ‘RemoveSpecial’ function that was written for me for a request in February to add match whole word functionality to a search an extract macro (http://www.msofficeforums.com/excel-...hes-whole.html). It is supposed to look for "\/:*?™""®<>|.&@#(_+`©~);-+=^$!,'" characters before or after the search term and accept it as a whole word match if found. But I can’t get it to find anything with this format macro.

The ‘Test_Whole_Word_Match’ I found online and it does a great job of identifying whole word matches (through a msgbox) but I am too VBA-dumb to figure out how to write code to make it format the found text if it matches a whole word search.

Can someone help with enabling the ‘‘Find_and_Highlight3’’ to include a whole word match search?
Attached Files
File Type: xlsm Sample File for Find and Format macro.xlsm (121.8 KB, 13 views)
Reply With Quote
Reply

Tags
find, format, whole word match

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to find and format with whole word match option Find a match and move row to top of page Auto Excel Programming 3 03-08-2016 01:17 AM
Macro to find and format with whole word match option Find a fuzzy match of a sentence. paik1002 Word VBA 1 02-18-2016 03:51 PM
Macro to find text in between two characters and then format selected text? qcom Word 5 02-19-2015 11:23 PM
Macro to find and format with whole word match option Find and Replace Format macro issue Jack Word VBA 2 12-12-2012 09:24 PM
Macro date and match valor cg1980 Excel Programming 0 04-12-2011 09:38 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 06:24 AM.


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