Home |
Search |
Today's Posts |
#8
![]()
Posted to microsoft.public.excel.worksheet.functions
|
|||
|
|||
![]()
To Sum the values of the blue cells use this UDF.
Note: both the countbycolor and sumbycolor functions are from Chip Pearson's site http://www.cpearson.com/excel/topic.aspx Function SumByColor(InRange As Range, SameColorAs As Range, _ Optional OfText As Boolean = False) As Double Dim WhatColorIndex As Integer If OfText = True Then WhatColorIndex = SameColorAs(1).Font.ColorIndex Else WhatColorIndex = SameColorAs(1).Interior.ColorIndex End If If OK And IsNumeric(rng.Value) Then SumByColor = SumByColor + rng.Value End If Next rng End Function To get a list of the index numbers for colors run this macro. Sub ListColorIndexes() Dim Ndx As Long Sheets.Add For Ndx = 1 To 56 Cells(Ndx, 1).Interior.ColorIndex = Ndx Cells(Ndx, 2).Value = Hex(ThisWorkbook.Colors(Ndx)) Cells(Ndx, 3).Value = Ndx Next Ndx End Sub On Sun, 12 Apr 2009 05:01:01 -0700, Michele R wrote: Hi thanks for that, it looks do-able! Would there be a similar simple way of adding the values in all the blue cells and the values of the red cells? And are there number codes for other colours, and how could I know what they are? Thanks for your help. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to use SUMIF to return sums between two values located in cells | Excel Worksheet Functions | |||
Formatting cells in Excel for certain Values to appear certain Col | Excel Worksheet Functions | |||
delete values in several cells without deleting the formulas | Excel Discussion (Misc queries) | |||
How to add a button to restore all altered cells original values? | Excel Discussion (Misc queries) | |||
calculate the sum of cells where values are between 6 and 10 in e. | Excel Worksheet Functions |