still learning
Well-known Member
- Joined
- Jan 15, 2010
- Messages
- 826
- Office Version
- 365
- Platform
- Windows
Hi
I have the following code in a module
In a cell I have
Where BG1 is formatted Black, and “cashweek4” is the range that I enter numbers.<?xml:namespace prefix = o /><o></o>
<o></o>
If I enter a number in black (in the range) the formula works fine. (it adds all the black numbers). If I change the entered number to a different color, the formula still thinks it’s black. If I start with a different color and then change it to black, the formula doesn’t recognize it. I have to retype the formula in the cell to get the proper solution. I tried to use F9, but it doesn’t help.<o></o>
What Am I doing wrong?
Mike <o></o>
<o></o>
I have the following code in a module
HTML:
Function ColorSum(ColorCell As Range, SumRange As Range) As Variant
Dim Cell As Range
For Each Cell In SumRange
If Cell.Font.ColorIndex = ColorCell.Font.ColorIndex Then
ColorSum = Cell + ColorSum
End If
Next
ColorSum = ColorSum
End Function
In a cell I have
HTML:
=colorSum(BG1, cashweek4)
Where BG1 is formatted Black, and “cashweek4” is the range that I enter numbers.<?xml:namespace prefix = o /><o></o>
<o></o>
If I enter a number in black (in the range) the formula works fine. (it adds all the black numbers). If I change the entered number to a different color, the formula still thinks it’s black. If I start with a different color and then change it to black, the formula doesn’t recognize it. I have to retype the formula in the cell to get the proper solution. I tried to use F9, but it doesn’t help.<o></o>
What Am I doing wrong?
Mike <o></o>
<o></o>