A community of 30,000 US Transcriptionist serving Medical Transcription Industry
Hey guys, this is for all the editscript users or people who can't use the auto list function in word. This macro will run through a list that looks like this:
2. cat.
9. dog
10. bird.
2. fish.
and corrects the numbers to look like this:
1. cat.
2. dog.
3. bird.
4. fish.
It stops after the list so nothing else gets changed.
To use it, create an empty macro and assign a hot key. Then go in to edit the macro and copy/paste the code.
So your macro will look like
----------------------------------------------------------------------
Sub Macro(some number or if you named it whatever name) ( )
paste the code here
End sub
-------------------------------------------------------------------------------
Then to test, you make a list. Insert your cursor like this
(cursor here)1. cat
then use your hot-key to invoke the macro. A popup comes up and asks where to start numbering, since you are on number one of the list type one, hit enter. If you had your cursor at #3 in the list you would type 3. The only catch is you have to have some number and a period for every item in the list. It can't look like this.
1. cat.
bird.
3. fish.
Here's the code to copy/paste.
Application.ScreenUpdating = False Dim Rng As Range, Para As Paragraph, i As Long Dim r As Range i = 1 On Error Goto ErrExit Set r = ActiveDocument.Range(Start:=Selection.Start, _ End:=ActiveDocument.Range.End) With r Set Rng = .Paragraphs.First.Range.Words.First If Trim(Rng.Text) Like "#" Or Trim(Rng.Text) Like "##" Then i = Trim(Rng.Text) End If i = CLng(InputBox("Please enter the starting number", "Paragraph re-numbering", i)) For Each Para In .Paragraphs Set Rng = Para.Range.Words.First Rng.End = Rng.End + 1 If Rng.Text Like "#." Or Rng.Text Like "##." Then Rng.Text = i & "." i = i + 1 Else Exit For End If Next End With ErrExit: Application.ScreenUpdating = True