View Single Post
 
Old 05-01-2012, 09:20 PM
ubns ubns is offline Windows 7 32bit Office 2010 32bit
Competent Performer
 
Join Date: Apr 2012
Posts: 177
ubns is on a distinguished road
Default Macro - replace with condition

Hi

I have the following code which replaces the .00 with blanks (nothing). In otherwords it removes .00 from the document.

But currently it is removing ".00" if it find anywhere such as .008 will change to 8.

I only want to change if ".00" is like 5.00. so only in this case it should remove ".00".


Sub find()
With Selection.find
.Text = ".00"
.Replacement.Text = ""
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
End With
'Selection.find.Execute replacewith:="" not required as the code is there.
Selection.find.Execute Replace:=wdReplaceAll
End Sub
Reply With Quote