I have a list that I want to add text at the end of select words

H

HTE

I Have a list of movies that I want to add a reference number to select
lines. For example:
4. 24_SEASON1_DISC3_8AM_12PM
5. 24_SEASON1_DISK1_12AM_4AM (1) like this
6. 24_SEASON1_DISK2_4AM_8AM (1)
7. 24_SEASON1_DISK4_12PM_4PM (1)
8. 24_SEASON1_DISK5_4PM_8PM
9. 24_SEASON1_DISK6_8PM_12AM
10. 24_SEASON2_DISC1_8AM_12PM
11. 24_SEASON2_DISC2_12PM_4PM
12. 24_SEASON2_DISC3_4PM_8PM
13. 24_SEASON2_DISC4_8PM_12AM
14. 24_SEASON2_DISC5_12AM_4AM
I was using different colored text, but I am running out of distinguishable
colors, so I now want to use a number at the end of each title. I can locate
the lines by the select text with similar formatting, and I want to add a
number at the end of each line of selected text. How can I add the text
which will be a number inside ( ) at the end of the lines like the above
example?
 
G

Graham Mayor

Assuming each line is a paragraph, the following macro will add " (1)" to
the end of the line the cursor is in.

Sub AddNum()
Dim oRng As Range
Set oRng = Selection.Range
oRng.End = oRng.Paragraphs(1).Range.End - 1
oRng.InsertAfter " (1)"
End Sub

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

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

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 

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