Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 8
Default Check Font or Font color and take action

This might be off the wall, but I will ask anyway.

I have 4 cells A1 thru D1 with numbers 1,2,3,4 respectively. E1 = sum of A1
thru D1 = 10

Is there a way to examine the font style or font color of each of the 4
cells to determine if that cell's value can be part of the E1 sum? So if B2
font color = red, then it would not be part of sum E1, therefore E1 = sum of
A1,C1,D1 = 8.

Appreciate any help
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default Check Font or Font color and take action

First enter this UDF

Function is_it_red(r As Range) As Boolean
If r.Font.ColorIndex = 3 Then
is_it_red = True
Else
is_it_red = False
End If
End Function

and then in E1 enter:

=is_it_red(A1)*A1+is_it_red(B1)*B1+is_it_red(C1)*C 1+is_it_red(D1)*D1

The function must be manually re-calculated if you change font color.
--
Gary's Student


"MSPLearner" wrote:

This might be off the wall, but I will ask anyway.

I have 4 cells A1 thru D1 with numbers 1,2,3,4 respectively. E1 = sum of A1
thru D1 = 10

Is there a way to examine the font style or font color of each of the 4
cells to determine if that cell's value can be part of the E1 sum? So if B2
font color = red, then it would not be part of sum E1, therefore E1 = sum of
A1,C1,D1 = 8.

Appreciate any help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Check Font or Font color and take action

Function SumNonRedFont(ref As Range) As Double
Dim ndSum As Double
Dim cel As Range

On Error Resume Next

For Each cel In ref
If cel.Font.Color < vbRed Then
ndSum = ndSum + cel.Value
End If
Next
SumNonRedFont = ndSum

End Function

This does not cater for font coloured by NumberFormat or Conditional Format

Regards,
Peter T


"MSPLearner" wrote in message
...
This might be off the wall, but I will ask anyway.

I have 4 cells A1 thru D1 with numbers 1,2,3,4 respectively. E1 = sum of

A1
thru D1 = 10

Is there a way to examine the font style or font color of each of the 4
cells to determine if that cell's value can be part of the E1 sum? So if

B2
font color = red, then it would not be part of sum E1, therefore E1 = sum

of
A1,C1,D1 = 8.

Appreciate any help



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Check Font or Font color and take action

Forgot to add the UDF will not recalc if user changes font, force with
Ctrl-Alt-F9

Regards,
Peter T

"Peter T" <peter_t@discussions wrote in message
...
Function SumNonRedFont(ref As Range) As Double
Dim ndSum As Double
Dim cel As Range

On Error Resume Next

For Each cel In ref
If cel.Font.Color < vbRed Then
ndSum = ndSum + cel.Value
End If
Next
SumNonRedFont = ndSum

End Function

This does not cater for font coloured by NumberFormat or Conditional

Format

Regards,
Peter T


"MSPLearner" wrote in message
...
This might be off the wall, but I will ask anyway.

I have 4 cells A1 thru D1 with numbers 1,2,3,4 respectively. E1 = sum of

A1
thru D1 = 10

Is there a way to examine the font style or font color of each of the 4
cells to determine if that cell's value can be part of the E1 sum? So if

B2
font color = red, then it would not be part of sum E1, therefore E1 =

sum
of
A1,C1,D1 = 8.

Appreciate any help





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
Conditional Format for font color using font color Jim Excel Worksheet Functions 2 August 29th 09 11:54 AM
Changing Font color based on font type or size John Excel Discussion (Misc queries) 2 February 7th 08 12:50 AM
how I can Check the color of font in excel cell ? im-EGY Excel Worksheet Functions 2 September 21st 06 06:02 PM
My fill color and font color do not work in Excel Std Edition 2003 chapstick Excel Discussion (Misc queries) 1 September 11th 05 08:48 PM
Why is first font action v-e-r-y slow? [email protected] Excel Discussion (Misc queries) 2 March 11th 05 08:01 AM


All times are GMT +1. The time now is 11:44 AM.

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"