PDA

View Full Version : Function for BOLD format



brunces
07-13-2005, 05:51 AM
Friends,

Please, is there any function in Excel for BOLD format?

I have a formula like this...

="There are "&B10&" users in the room now!"

I want only the "number of users (B10)" in BOLD format, so I'd like to know if there's a function to do that. It would be something like this...

="There are "&BOLD(B10)&" users in the room now!"

If there's not, how could I create this function in VBA?

A friend of mine told me it's impossible to do. But, wouldn't it be the same process of the functions UPPER(range) and LOWER(range)? I mean, if it's possible to deal with upper or lower cases using functions, maybe it's possible to deal with bold format as well, ain't it? Am I wrong?

When the value of a cell is a text, it's possible to put bold format only for the words we want, instead of putting for the (entire) cell intself. But when the cell has a formula, that's not possible anymore. That's why I thought about a function. :)

Is it really impossible?

Thanks for the attention, guys.

Hugs. :)

Bruno

Justinlabenne
07-13-2005, 07:55 AM
Hmm.....I don't know if it can be done the exact way you want it, and I don't know which cell is supposed to say "There are a x number of users in the room now!" but here's a sample.

Option Explicit

Private Sub Worksheet_Calculate()
Dim r As Range
Dim r2 As Range

Set r = Range("B10")
Set r2 = Range("C10")

Application.EnableEvents = False

r.Offset(, 1).Value = "There are " & r.Value & " users in the room now!"

With r2
.Characters(InStr(r2.Value, r), Len(CStr(r))).Font.FontStyle = "Bold"
End With


Application.EnableEvents = True
End Sub

Steiner
07-13-2005, 10:28 PM
Hi Justin,
and do you know a way to do this while the cell to format actually contains a formula? Because here at EE (http://oldlook.experts-exchange.com:8080/Applications/MS_Office/Excel/Q_21489800.html) this does not seem so.

Daniel

Justinlabenne
07-14-2005, 07:28 AM
What I've got above is the only thing I have ever been able to come up with as a workaround to this question.

I have not come up with any rational ideas as to how to go about changing formatting within a formula. Most resposnes on the boards from MrExcel, etc.. say it cannot be done, and I am pretty much going to mark it as impossible.

I have attempted custom number formats, etc.. but never spent a lot of time it because it just does not seem possible or even if, reliable.

Now that that is said, someone will post and prove me wrong.

mdmackillop
07-14-2005, 11:01 AM
Another workaround.