#1
|
|||
|
|||
Highlight numbers after a specific word in numbered list
Hi,
I would like to be able to highlight numbers within a numbered list that a) follow the word 'point' and b) are higher than the number in the numbered list e.g. 4. In accordance with point 3, this is ok. [In this instance '3' doesn't need to be highlighted, as it is lower than 4] 5. In accordance with point 6, this is not ok. [In this instance '6' should be highlighted, as it is higher than 5] Is there a way to do this using a macro in Word? I've been searching and couldn't find a way to do it. |
#2
|
||||
|
||||
This is an interesting question and a macro could most likely be created but it would get very complex in a hurry. For instance, your post begins with point a & b which immediately raises the possibility of the same in your content. Also can a list be 1.1, 1.2, 2, 3, 3.1, 3.2 or 1a, 1b etc. What if an author says 'item 3' or 'clause 3' or 'point 3 of clause 27.2'?
Are your lists always using only arabic numerals and only ever contain one number stream? Is the key word ALWAYS the same and ALWAYS only referring to points in the same list? To get you started, you can get the current value of the list element with Selection.Range.ListFormat.ListString
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#3
|
|||
|
|||
Hi, yes in this particular case, the key word is always the same and just referring to points in the same list. It is also the case that it just refers to Arabic numerals and that they just follow a 1. , 2., 3. format (no sub-clauses etc.).
For the a) and b), this was just a stylistic preference of mine, and is not included in the content itself. |
#4
|
||||
|
||||
Perhaps:
Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "point [0-9]@>" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchWildcards = True .Execute End With Do While .Find.Found .Start = .Words.First.End If .Text > .Paragraphs.First.Range.ListFormat.ListString Then .HighlightColorIndex = wdBrightGreen End If .Collapse wdCollapseEnd .Find.Execute Loop End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
VBA to highlight numbers from an excel list | mbesspiata3 | Word VBA | 1 | 04-19-2016 04:20 PM |
Problem with bold numbers in multi-level list styles when having numbered headings AND paragraphs | bwofficer | Word | 2 | 12-12-2014 12:21 AM |
Highlight Words from a Word List | JSC6 | Word VBA | 1 | 09-30-2014 08:22 PM |
Numbers in Numbered List Insist on Being Bold | peytontodd | Word | 2 | 09-19-2014 11:01 AM |
Word Mixing Numbered Headings with Numbered List | Tess0 | Word | 11 | 07-15-2014 05:25 AM |