View Full Version : Change Font Within Formula
BonnieG
02-24-2010, 11:11 AM
Is this doable?
I have the following formula
="TOTAL PAYMENT AMOUNT DUE"&" "&TEXT(SUM(E3:E65000),"$#,##0.00")
This is the answer
TOTAL PAYMENT AMOUNT DUE $2,029,838.40
Can I make the numbers a different font and/or color than the text?
Using the Characters Object
Use Characters(start, length), where start is the start character number and length is the number of characters, to return a Characters object. The following example adds text to cell B1 and then makes the second word bold.
With Worksheets("Sheet1") _
.Range("B1") _
.Value = "New Title" _
.Characters(5, 5).Font.Bold = True
End With
Pinokkio
02-24-2010, 02:29 PM
Or If you split them into 2 cells, you can do wat you like.
="TOTAL PAYMENT AMOUNT DUE "
and
=SUM(E3:E65000)
P.
youngtrand
07-12-2012, 11:36 AM
Using the Characters Object
Use Characters(start, length), where start is the start character number and length is the number of characters, to return a Characters object. The following example adds text to cell B1 and then makes the second word bold.
With Worksheets("Sheet1") _
.Range("B1") _
.Value = "New Title" _
.Characters(5, 5).Font.Bold = True
End With
Hey, i'm having trouble with this code, i'm sure it is just a simple fix
With Worksheets("Sheet1") _
.Range("B1") _
.Value = "New Title" _
.Characters(5, 5).Font.Bold = True
End With
Basically everything is fine, just I want to have this apply to cells that already have text in them, not have it put in the phrase "new title" and then bold the second word. Is this possible, example: In cell A2 I have the writing "excel is fun!" and i would like to be able to run the macro and have it change the "is fun" part bold. Ideally I would like to have this work for a range of cells as well, i.e. A1:B45.
Kenneth Hobs
07-12-2012, 01:52 PM
Why not use two cells?
In a formula, you will need to convert it to a value.
Sub RedNumbers()
Dim i As Integer
Dim s As String
With ActiveCell
.Value = .Value
s = .Value
For i = 1 To Len(s)
If IsNumeric(Mid(s, i, 1)) Then .Characters(i, 1).Font.Color = vbRed
Next i
End With
End Sub
Powered by vBulletin® Version 4.2.5 Copyright © 2024 vBulletin Solutions Inc. All rights reserved.