Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #1  
Old 11-16-2014, 03:09 PM
Marrick13 Marrick13 is offline VBA to search each row of a word table column Windows XP VBA to search each row of a word table column Office 2010 32bit
Competent Performer
VBA to search each row of a word table column
 
Join Date: Jun 2006
Posts: 103
Marrick13 will become famous soon enough
Default VBA to search each row of a word table column

I am trying to finish a macro that searches a selected Word column for user-entered text. I have a module that works, except that I need the search code to perform a 'MatchWholeWord' query and count the hits. The only way I know to do that is with a 'Do While .Execute' statement, but I'm having trouble getting it to search the column properly.



The code is have is in the the attached 'Count_Column_Text' file. I was using 'If InStr(oCell.Range.Text, TargetText) > 0 Then i = i + 1' (commented out in the attachment) and it found each occurrence of the search text. But it doesn't match the whole word, so if my search text phrase includes a word that exists by itself in several cells, those single words are included in the count.

Can someone advise how to do a proper match whole word query with a counter?
Attached Files
File Type: txt Count_Column_Text.txt (2.0 KB, 14 views)
Reply With Quote
 

Tags
column, count, search



Similar Threads
Thread Thread Starter Forum Replies Last Post
VBA to search each row of a word table column Macro help - search for value, paste a value in another column IRollman Excel Programming 1 01-14-2014 01:05 PM
Excel Fomula to search for a string and display value from different column zeeshanbutt Excel 1 07-29-2012 12:48 AM
VBA to search each row of a word table column Word 2007: Automatically left-justified centered table or column? wornways Word 1 03-13-2012 12:18 AM
VBA to search each row of a word table column Need to search a column for a macth and return a result from a third column pdfaust Excel 2 02-03-2011 03:02 PM
How do I reference a merged cell in a multi column & row table in MS Word ('03')? jihanemo Word Tables 0 03-18-2009 08:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 08:30 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