Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Gary
 
Posts: n/a
Default How do I show True as a value in Excel B2 if Cell B1 is bold?

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.
  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
JE McGimpsey
 
Posts: n/a
Default How do I show True as a value in Excel B2 if Cell B1 is bold?

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 ,
"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.

  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default How do I show True as a value in Excel B2 if Cell B1 is bold?

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" wrote in message
...
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.



  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Jim Thomlinson
 
Posts: n/a
Default How do I show True as a value in Excel B2 if Cell B1 is bold?

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
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
Urgent date/scheduling calc needed jct Excel Worksheet Functions 3 February 24th 06 01:36 AM
Excel: with an if condition display a row of cell if true Seema Yadav Excel Discussion (Misc queries) 7 January 12th 06 09:58 PM
Cell shading in excel doesn't show. joecec New Users to Excel 1 October 19th 05 04:24 AM
UDF and Calculation tree Ken Wright Links and Linking in Excel 1 February 6th 05 04:58 PM
how do I show a picture in excel based on cell data Wishing to Excel Excel Discussion (Misc queries) 2 January 10th 05 04:39 PM


All times are GMT +1. The time now is 05:39 PM.

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

About Us

"It's about Microsoft Excel"