Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 11-09-2014, 12:04 PM
jrt jrt is offline Numeric Values Windows 7 32bit Numeric Values Office 2010 32bit
Novice
Numeric Values
 
Join Date: Nov 2014
Posts: 2
jrt is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 11-09-2014, 12:41 PM
gmaxey gmaxey is offline Numeric Values Windows 7 32bit Numeric Values Office 2010 (Version 14.0)
Expert
 
Join Date: May 2010
Location: Brasstown, NC
Posts: 1,429
gmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the roughgmaxey is a jewel in the rough
Default

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
__________________
Greg Maxey
Please visit my web site at http://www.gregmaxey.com/
Reply With Quote
  #3  
Old 11-09-2014, 01:28 PM
macropod's Avatar
macropod macropod is offline Numeric Values Windows 7 64bit Numeric Values Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
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

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

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
Numeric Values Sorting Alphanumeric & Numeric values slovenc0417 Excel 2 06-07-2013 07:58 PM
Numeric Values Handle Text / Numeric values in SSRS while Export To Excel achuki Excel 5 02-07-2012 02:14 PM
Numeric Values [How To] Generate Alpha Numeric Values in Excel 2010 stnicholas81 Excel 1 07-25-2011 01:31 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:21 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