Selecting before a character to make bold...

  • Thread starter Thread starter rohit92
  • Start date Start date
R

rohit92

Hey guys,
I think this might help me in the future, but I want to use something like
this for school. Say i have this text:
"dog- an animal that barks
cat- an animal that meows"

So what I want to do is select the words before the "-" to make them bold.
The words dog and cat should be bold. Sometimes i have very large lists to do
this with and it gets annoying to constantly select each word and make it
bold.. So let me know if it is possible.
 
If you hold the Alt key, you can use the mouse to select vertically.

Alternatively, you should be able to use Find and Replace.
 
Select the list and run the following macro:

Dim oRng As Range
For i = 1 To Selection.Paragraphs.Count
Set oRng = Selection.Paragraphs(i).Range
With oRng
.MoveEndUntil "-", wdBackward
.End = .End - 1
.Bold = True
End With
Next i

If there is no list selected, the macro operates on the paragraph containing
the cursor.

http://www.gmayor.com/installing_macro.htm


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
Back
Top