#1
|
|||
|
|||
Numeric Values
Hi,
I am new to MS Word VBA. I need to highlight (specific colour -red) and change font size all numeric values in the word file (Around 400 to 800 pages). Numeric values in different formats : Eg : 133,498.34 133.498.56 133 498.23 133'498.45 The values will be in table format too. Like. A 12 12 b 12 87 c 23 45 Numeric values both in table format and running text in world file Can any one please. Last edited by jrt; 11-09-2014 at 12:33 PM. Reason: Adding text |
#2
|
|||
|
|||
Try:
Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim oRng As Word.Range Set oRng = ActiveDocument.Range With oRng.Find .ClearFormatting .Text = "[0-9]{1,3}[ .,']{1}[0-9]{3}.[0-9]{2}" With .Replacement .Text = "" With .Font .ColorIndex = wdRed .Size = 18 End With End With .Format = True .MatchWildcards = True .Execute Replace:=wdReplaceAll End With End Sub |
#3
|
||||
|
||||
You can do all of this via wildcard Find/Replace, without the need for a macro. For example:
Find = [0-9]{1,} Replace = ^& will find & replace all number sequences. All you need do is specify the replacement font colour. For the separators, you could use: Find = [0-9][,.'][0-9] Replace = ^& Of course, you could also use the macro recorder to record these as a macro.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Tags |
numeric values |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Convert alphabets to numeric values | kjxavier | Word | 3 | 07-06-2014 05:34 AM |
Convert numeric values with decimals to alphabets | kjxavier | Word | 1 | 07-06-2014 01:44 AM |
Sorting Alphanumeric & Numeric values | slovenc0417 | Excel | 2 | 06-07-2013 07:58 PM |
Handle Text / Numeric values in SSRS while Export To Excel | achuki | Excel | 5 | 02-07-2012 02:14 PM |
[How To] Generate Alpha Numeric Values in Excel 2010 | stnicholas81 | Excel | 1 | 07-25-2011 01:31 AM |