Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Jackie,
you can format substrings in cells as suggested above. Your first problen is to search for the word in the cells, then find its position in the string. Once you have done this you can apply your formating. Below is an example from the macro recorder where I applied different formats to part of a string. Range("F1").Select ActiveCell.FormulaR1C1 = "MyClasses.Add item := Inst, key := CStr(Num)" With ActiveCell.Characters(Start:=1, Length:=2).Font .Name = "Arial Unicode MS" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=3, Length:=7).Font .Name = "Arial Unicode MS" .FontStyle = "Bold" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=10, Length:=1).Font .Name = "Arial Unicode MS" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=11, Length:=3).Font .Name = "Arial Unicode MS" .FontStyle = "Bold" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=14, Length:=1).Font .Name = "Arial Unicode MS" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=15, Length:=8).Font .Name = "Arial Unicode MS" .FontStyle = "Bold" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=23, Length:=6).Font .Name = "Arial Unicode MS" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=29, Length:=6).Font .Name = "Arial Unicode MS" .FontStyle = "Bold" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=35, Length:=10).Font .Name = "Arial Unicode MS" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With End Sub -- Tony Green "jaikal24" wrote: Is there a way to change the formatting (make it bold or change the font color) of all the instances of a particular word (not the whole cell) in excel ? I am able to do it in word but would like to use the macro in excel & power point also. Any help would be appreciated. Thanks, Jackie -- jaikal24 ------------------------------------------------------------------------ jaikal24's Profile: http://www.excelforum.com/member.php...o&userid=35213 View this thread: http://www.excelforum.com/showthread...hreadid=549781 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Multiple Instances Excel07..Excel Paste Special Menu Uses Word PS | Excel Discussion (Misc queries) | |||
change the color of one word throughout a worksheet | Excel Worksheet Functions | |||
I only want to change the formatting of one word in an Excel cell | Excel Discussion (Misc queries) | |||
Excel Macro to find instances of a word | Excel Discussion (Misc queries) | |||
Find and replace of word causes change of font formatting | New Users to Excel |