How to use <find Property> with condition?

T

Togetherwith

Hi,
The find property can automatically search the text given the searche
word. Now my problem is how to let find property to serach word in th
last column in the document.

My situation is that I have a document with many numbers. The number i
the last tow Column (col 79-81) have some rules. So I want the <find
statement just can search the col 79-81 on every row, and feedback m
the row number with the expected number. The document is like this:
1 5 2 21 24 5
1 5 6 23 15 6
1 5 5 14 15 7

I want to search the last column, such as "6", and feedback me the ro
number ( in this example, 2)
Thank you
 
D

Doug Robbins - Word MVP - DELETE UPPERCASE CHARACT

Use

Dim myrange As Range
Selection.HomeKey wdStory
Selection.Find.ClearFormatting
With Selection.Find
Do While .Execute(FindText:=" 6^p", MatchWildcards:=False,
Wrap:=wdFindStop, Forward:=True) = True
Set myrange = Selection.Range
myrange.Start = ActiveDocument.Range.Start
MsgBox "The numeral 6 is at the end of row " &
myrange.Paragraphs.Count
Loop
End With


--
Please post any further questions or followup to the newsgroups for the
benefit of others who may be interested. Unsolicited questions forwarded
directly to me will only be answered on a paid consulting basis.

Hope this helps
Doug Robbins - Word MVP
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top