Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Using bold and normal font within one cell

In Excel you can manually change some of the formatting
for part of a cell. This allows you for example to only
make selected parts of the contents of the cell bold
rather than everything.

Does anyone know how you can do this with VBA?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,337
Default Using bold and normal font within one cell

Here is one I just recorded. Of course it needs a LOT of cleaning up to do
just what you want. But, you get the idea. BTW, you cannot do this with a
formula.

Sub Macro3()
'
' Macro3 Macro
' Macro recorded 1/8/2004 by Don Guillett
'

'
Range("E9").Select
ActiveCell.FormulaR1C1 = "Date"
With ActiveCell.Characters(Start:=1, Length:=2).Font
.Name = "Courier"
.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:=2).Font
.Name = "Courier"
.FontStyle = "Regular"
.Size = 10
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 3
End With
Range("E5").Select
End Sub


--
Don Guillett
SalesAid Software

"Paul" wrote in message
...
In Excel you can manually change some of the formatting
for part of a cell. This allows you for example to only
make selected parts of the contents of the cell bold
rather than everything.

Does anyone know how you can do this with VBA?



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Using bold and normal font within one cell

Paul

Sub CellFont()
With ActiveCell.Characters(Start:=1, length:=3).Font
.ColorIndex = 3
.Bold = True
.Underline = True
End With
With ActiveCell.Characters(Start:=4, length:=3).Font
.Superscript = True
.ColorIndex = 5
End With
End Sub

Adjust to suit.

Gord Dibben Excel MVP

On Thu, 8 Jan 2004 08:41:48 -0800, "Paul" wrote:

In Excel you can manually change some of the formatting
for part of a cell. This allows you for example to only
make selected parts of the contents of the cell bold
rather than everything.

Does anyone know how you can do this with VBA?


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
If Cell is Blank (Though a Link), Hide Result, Else Normal Font Mary Excel Worksheet Functions 5 December 23rd 08 06:22 PM
if font is bold then cell value is number Jon Excel Discussion (Misc queries) 1 September 13th 08 11:50 AM
How to count number of Cell have Strike Through Effect & Bold as font style. Akash Maheshwari Excel Discussion (Misc queries) 6 June 29th 07 09:39 PM
how do i make one part of my formula bold and the other normal? niquey Excel Worksheet Functions 6 March 27th 06 03:22 PM
Can you keep a cells BOLD Font, cell color size Trese Excel Discussion (Misc queries) 2 August 23rd 05 03:09 PM


All times are GMT +1. The time now is 04:45 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"