Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-26-2019, 05:10 AM
liblikas90 liblikas90 is offline Highlight numbers after a specific word in numbered list Windows 10 Highlight numbers after a specific word in numbered list Office 2016
Novice
Highlight numbers after a specific word in numbered list
 
Join Date: Feb 2019
Posts: 2
liblikas90 is on a distinguished road
Default 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.
Reply With Quote
  #2  
Old 02-26-2019, 05:15 PM
Guessed's Avatar
Guessed Guessed is offline Highlight numbers after a specific word in numbered list Windows 10 Highlight numbers after a specific word in numbered list Office 2016
Expert
 
Join Date: Mar 2010
Location: Canberra/Melbourne Australia
Posts: 3,932
Guessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant futureGuessed has a brilliant future
Default

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
Reply With Quote
  #3  
Old 02-27-2019, 12:21 AM
liblikas90 liblikas90 is offline Highlight numbers after a specific word in numbered list Windows 10 Highlight numbers after a specific word in numbered list Office 2016
Novice
Highlight numbers after a specific word in numbered list
 
Join Date: Feb 2019
Posts: 2
liblikas90 is on a distinguished road
Default

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.
Reply With Quote
  #4  
Old 02-27-2019, 03:52 AM
macropod's Avatar
macropod macropod is offline Highlight numbers after a specific word in numbered list Windows 7 64bit Highlight numbers after a specific word in numbered list Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,956
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

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]
Reply With Quote
Reply

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
Highlight numbers after a specific word in numbered list 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 numbers after a specific word in numbered list 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

Other Forums: Access Forums

All times are GMT -7. The time now is 12:31 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft