Highlighting

S

Steved

Hello from Steved

I would like please a macro to Highlite the below

What is reqired is highlite only the begining to last letter

For example 15 STAR OF JUDD not 3766

15 STAR OF JUDD 3766
14 LADY EXPRESS 3566
9 DANZATIGER 2063

Thankyou.
 
H

Helmut Weber

Hi Steved,

many ways.

The last letter in a paragraph is equal
to the first letter when searching backwards
from the paragraph's end.

Sub Test40()
Dim rPrg As Range
With Selection
.Collapse
.ExtendMode = False
Set rPrg = .Paragraphs(1).Range
End With
With rPrg.Find
.Text = "[A-Z]"
.MatchWildcards = True
.Forward = False
.Execute
rPrg.Start = Selection.Paragraphs(1).Range.Start
rPrg.HighlightColorIndex = wdYellow
End With
End Sub

Of course, it is assumed that there is a letter...

HTH

--
Greetings from Bavaria, Germany

Helmut Weber, MVP WordVBA

Win XP, Office 2003
"red.sys" & Chr$(64) & "t-online.de"
 

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

Similar Threads


Top