PC Review


Reply
Thread Tools Rate Thread

Check Font or Font color and take action

 
 
=?Utf-8?B?TVNQTGVhcm5lcg==?=
Guest
Posts: n/a
 
      15th Nov 2006
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 With Quote
 
 
 
 
=?Utf-8?B?R2FyeScncyBTdHVkZW50?=
Guest
Posts: n/a
 
      15th Nov 2006
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)*C1+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

 
Reply With Quote
 
Peter T
Guest
Posts: n/a
 
      15th Nov 2006
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" <(E-Mail Removed)> wrote in message
news:4D29F515-206F-4D2A-8A10-(E-Mail Removed)...
> 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 With Quote
 
Peter T
Guest
Posts: n/a
 
      15th Nov 2006
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
news:uqDw#(E-Mail Removed)...
> 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" <(E-Mail Removed)> wrote in message
> news:4D29F515-206F-4D2A-8A10-(E-Mail Removed)...
> > 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 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
Look at font color and take action troy_lee@comcast.net Microsoft Excel Discussion 1 22nd Jan 2009 06:03 PM
Change font color from a check box =?Utf-8?B?RnJlZA==?= Microsoft Access Form Coding 1 30th Aug 2007 11:00 PM
how I can Check the color of font in excel cell ? =?Utf-8?B?aW0tRUdZ?= Microsoft Excel Worksheet Functions 2 21st Sep 2006 06:02 PM
Practice run of presentation changed font color of action setting =?Utf-8?B?UFogU3RyYXViZQ==?= Microsoft Powerpoint 2 27th Apr 2005 10:48 AM
Re: Hard drive <font color="blue"><B>data</B></font&g t; <font color="blue"><B>recovery</B></fo nt> services? halleyscomet@gmail.com Storage Devices 0 7th Dec 2004 03:11 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:26 AM.