PC Review


Reply
Thread Tools Rate Thread

How do I show True as a value in Excel B2 if Cell B1 is bold?

 
 
=?Utf-8?B?R2FyeQ==?=
Guest
Posts: n/a
 
      27th Feb 2006
I want to be able to determine whether the text in any given cell is bold,
and display that information as a true/false value in an adjoining cell.

Can you tell me how to accomplilsh this?

Thanks.
 
Reply With Quote
 
 
 
 
JE McGimpsey
Guest
Posts: n/a
 
      27th Feb 2006
One way:

Put this in a regular code module:

Public Function IsBold(rRng As Range) As Boolean
Dim rCell As Range
Dim bTemp As Boolean
Application.Volatile
If rRng.Count = 1 Then
IsBold = rRng.Font.Bold
Else
bTemp = True
For Each rCell In rRng
bTemp = bTemp And rCell.Font.Bold
If Not bTemp Then Exit For
Next rCell
IsBold = bTemp
End If
End Function


Since changing format doesn't trigger a calculation, this can only be
guaranteed to be accurate after recalculating the sheet (and is the
reason for the Application.Volatile statement).

If you're not familiar with UDF's see

http://www.mvps.org/dmcritchie/excel/getstarted.htm



In article <75D3EAA2-E6AF-4CCB-9635-(E-Mail Removed)>,
"Gary" <(E-Mail Removed)> wrote:

> I want to be able to determine whether the text in any given cell is bold,
> and display that information as a true/false value in an adjoining cell.
>
> Can you tell me how to accomplilsh this?
>
> Thanks.

 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      27th Feb 2006
You can use a UDF

Function IsBold(rng As Range)
Application.Volatile
If rng.Count > 1 Then
IsBold = CVErr(xlErrRef)
Else
IsBold = rng.Font.Bold
End If
End Function

and use like =IsBold(A1)

but it doesn't automatically upadte if the cell changes, you need to F9.

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"Gary" <(E-Mail Removed)> wrote in message
news:75D3EAA2-E6AF-4CCB-9635-(E-Mail Removed)...
> I want to be able to determine whether the text in any given cell is bold,
> and display that information as a true/false value in an adjoining cell.
>
> Can you tell me how to accomplilsh this?
>
> Thanks.



 
Reply With Quote
 
=?Utf-8?B?SmltIFRob21saW5zb24=?=
Guest
Posts: n/a
 
      27th Feb 2006
The long and the short of it is that you can only sort of do this. It
requires a user defined function that only sort of does what you asked. The
problem is that changing a cell format does not re-caclulate the sheet. You
want is a formula to evaluate to True or False, but it won't recalc
automatically. Here is some code that you can put in the same place as you
would find a recorded macro.

Public Function IsBold(ByVal TargetCell As Range) As Boolean
Application.Volatile
IsBold = TargetCell.Font.Bold
End Function

In the cell that you want to evaluate to true or false type in the formula

=IsBold(A1)

This will return true or false depending on the font in A1. The problem
arises if the font in A1 is changed. The formula will not re-evaluate until a
calculation is run (press F9 to see what I mean)...
--
HTH...

Jim Thomlinson


"Gary" wrote:

> I want to be able to determine whether the text in any given cell is bold,
> and display that information as a true/false value in an adjoining cell.
>
> Can you tell me how to accomplilsh this?
>
> Thanks.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
bold text of referenced cell show in formula cell zabcikranch Microsoft Excel Worksheet Functions 1 2nd Feb 2010 07:42 PM
Show results in bold if a cell is in bold Diana Microsoft Excel Discussion 2 20th Dec 2009 05:18 PM
conditional formating bold is true not bold false how victorio0704 Microsoft Excel Programming 4 25th Jun 2008 04:29 PM
Conditional Formating a cell .. to Show Nothing .. if True =?Utf-8?B?bW9uaXI=?= Microsoft Excel Worksheet Functions 4 30th Mar 2006 09:33 AM
Make cell bold if true BldrBldr Microsoft Excel Worksheet Functions 1 9th Feb 2004 10:03 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:43 PM.