![]() |
#3
|
||||
|
||||
![]()
It can be shorter
Code:
Sub Comma() Dim aRng As Range Set aRng = ActiveDocument.Range With aRng.Find .ClearFormatting .Text = "[0-9]{4,}" .Wrap = wdFindStop .MatchWildcards = True Do While .Execute = True If aRng.Text Like "20??" Then aRng.HighlightColorIndex = wdBrightGreen Else aRng.Text = Format(aRng.Text, "#,##0") End If aRng.Collapse Direction:=wdCollapseEnd Loop End With End Sub
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
Tags |
comma, vba |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Robert Kay | Word VBA | 6 | 02-21-2018 04:41 PM |
List of figures with several labels (caption) - Table of Figures sorting | ibra_ca | Word | 2 | 10-11-2017 07:02 AM |
Automatic table of figures includes one of the figures, not just the caption - help! | sarahlt | Word | 1 | 09-28-2014 09:34 AM |
![]() |
sleake | Word | 8 | 09-15-2013 02:42 PM |
Plotting Numerical and Non-numerical Data Set | Ife | Excel | 0 | 04-23-2012 10:35 AM |