View Single Post
 
Old 02-03-2014, 02:12 AM
tomlam tomlam is offline Windows 7 64bit Office 2007
Advanced Beginner
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default how to italic the word with vba

dear all

we would like to italic the word "peter" in column e

peter is good
peter is bad
he is peter
pet is animal

the result will be

peter is good
peter is bad
he is peter
pet is animal

the vba code dont run , what wrong...? pls help

Sub testz()
For i = 1 To 100
pos = InStr(Range("e(i)").Value, "peter")

With Range("e(i)").Characters(Start:=pos, Length:=5).Font
.FontStyle = "Italic"

End With
Next
End Sub

Thanks
Tom
Reply With Quote