Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Adding cells in a range based on format color

Would anyone like to tell me how it would be possible to add only the cells
that are colored e.g. red through a range

Mo


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Adding cells in a range based on format color

Would anyone like to tell me how it would be possible to
add only the cells that are colored e.g. red through a range


Function SumRed(Target As Range) As Integer
Dim c As Range

For Each c In Target
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + 1
Next c
End Function

HTH,
Merjet


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Adding cells in a range based on format color

Mo,
You need to use a VBA procedure to do this. See the SumByColor function at
www.cpearson.com/excel/colors.htm .


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
www.cpearson.com


"Mo" wrote in message
...
Would anyone like to tell me how it would be possible to add only the

cells
that are colored e.g. red through a range

Mo




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 812
Default Adding cells in a range based on format color

If c.Interior.ColorIndex = 3 Then SumRed = SumRed + 1
That should have been:
If c.Interior.ColorIndex = 3 Then SumRed = SumRed + c

Merjet


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Adding cells in a range based on format color

Thanks to Chip & merjet for the help


"Mo" wrote in message
...
Would anyone like to tell me how it would be possible to add only the

cells
that are colored e.g. red through a range

Mo




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
How to Color a Cell Based on a Range of Cells with Colors ron weasley Excel Worksheet Functions 1 January 13th 10 01:05 AM
color a range of cells based on a criteria Dave F Excel Discussion (Misc queries) 2 October 13th 06 02:29 PM
Is there a way to count cells in a range based on fill color? eehinmd Excel Worksheet Functions 2 March 16th 06 05:09 PM
adding color to cells based on a formula fyrfytr265 Excel Worksheet Functions 2 November 1st 05 05:17 PM
Adding colour to a range of cells based on one of the cells v... McKenna Excel Discussion (Misc queries) 4 March 11th 05 02:25 PM


All times are GMT +1. The time now is 07:59 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"