Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing Font in a Cell
How can I change the font of only a portion of the text within a cell. In my
application I want the first portion of text to be Bold and the second portion of text to be Italics. This is something you can do within Excel but I cannot figure out how to do it programatically. I can change the font of the entire cell but not a portion of it. Any ideas on how I can accomplish this? |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Changing Font in a Cell
On Aug 31, 10:06 am, "Robert Sheppard" wrote:
How can I change the font of only a portion of the text within a cell. In my application I want the first portion of text to be Bold and the second portion of text to be Italics. This is something you can do within Excel but I cannot figure out how to do it programatically. I can change the font of the entire cell but not a portion of it. Any ideas on how I can accomplish this? Hi Robert, Try this and tweak it with the font you want Sub test() ActiveCell.FormulaR1C1 = "ABCD EFGH" With ActiveCell.Characters(Start:=1, Length:=5).Font .Name = "Arial" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With With ActiveCell.Characters(Start:=6, Length:=4).Font .Name = "Bodoni MT Black" .FontStyle = "Regular" .Size = 10 .Strikethrough = False .Superscript = False .Subscript = False .OutlineFont = False .Shadow = False .Underline = xlUnderlineStyleNone .ColorIndex = xlAutomatic End With Range("B1").Select End Sub |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Changing font colour depending on cell value | Excel Worksheet Functions | |||
Changing the font of a cell dependant on the outcome | Excel Worksheet Functions | |||
Retaining Changing Font Color in Cell | Excel Programming | |||
changing font colour of row when cell contains date | Excel Programming | |||
Changing font of part of text in a cell | Excel Programming |