Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 02-03-2014, 02:12 AM
tomlam tomlam is offline how to italic the word with vba Windows 7 64bit how to italic the word with vba Office 2007
Advanced Beginner
how to italic the word with vba
 
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
  #2  
Old 02-03-2014, 07:09 PM
tomlam tomlam is offline how to italic the word with vba Windows 7 64bit how to italic the word with vba Office 2007
Advanced Beginner
how to italic the word with vba
 
Join Date: Oct 2012
Posts: 33
tomlam is on a distinguished road
Default

oh the answer is as follows. the problems solved

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

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

End With
Next a
End Sub
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
how to italic the word with vba Find text, format part of text in italic d4okeefe Word VBA 18 06-30-2022 11:35 PM
how to italic the word with vba How to "replace" a word with same word but "Italic"? Jamal NUMAN Word 4 07-08-2011 04:02 AM
Can't use Bold and Italic khmerguy Word 3 03-31-2011 12:48 PM
how to italic the word with vba Can't print bold or italic text cornettd PowerPoint 1 05-10-2010 10:07 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:59 AM.


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