Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 106
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Changing font colour depending on cell value RunRonnyRun Excel Worksheet Functions 1 October 27th 08 08:28 PM
Changing the font of a cell dependant on the outcome Bemused Scot Excel Worksheet Functions 1 September 25th 07 12:01 PM
Retaining Changing Font Color in Cell roadkill Excel Programming 3 October 18th 06 01:22 PM
changing font colour of row when cell contains date jason Excel Programming 3 May 8th 04 11:24 PM
Changing font of part of text in a cell Ross Withey Excel Programming 4 November 11th 03 02:09 AM


All times are GMT +1. The time now is 08:34 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"