Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count if - background colour & value
I'm trying to count cells which have a certain background
colour, but which also have a specific value. I'm able to count background colour using this: For Each Rng In inrange.Cells '' If activecell.value <= 52 Then "this bit doesn't work" If OfText = True Then CountbyColour = CountbyColour - (Rng.Interior.ColorIndex = 38) Else 'nothing End If Next Rng End Function But i can't get the function to work if i addin the condition of cell value, as well as background colour. I've also tried leaving the criteria out of the function and enforcing the criteria in the cell by using =IF(A1:B10 <=52,countbycolour(A1:B10,38,TRUE),"0") But it ignores the "<= 52" bit Any suggestions would be much appreciated. Glenn |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Count if - background colour & value
instead of using ActiveCell, which won't change in your loop, use
Rng: For Each Rng In inrange.Cells If Rng.Value <= 52 Then _ If ofText = True Then _ CountbyColour = CountbyColour - _ (Rng.Interior.ColorIndex = 38) Next Rng In article , "Glenn" wrote: I'm trying to count cells which have a certain background colour, but which also have a specific value. I'm able to count background colour using this: For Each Rng In inrange.Cells '' If activecell.value <= 52 Then "this bit doesn't work" If OfText = True Then CountbyColour = CountbyColour - (Rng.Interior.ColorIndex = 38) Else 'nothing End If Next Rng End Function But i can't get the function to work if i addin the condition of cell value, as well as background colour. I've also tried leaving the criteria out of the function and enforcing the criteria in the cell by using =IF(A1:B10 <=52,countbycolour(A1:B10,38,TRUE),"0") But it ignores the "<= 52" bit Any suggestions would be much appreciated. Glenn |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Sheet Background Colour | Excel Discussion (Misc queries) | |||
change a cell background colour to my own RGB colour requirements | Excel Discussion (Misc queries) | |||
change background colour | Excel Discussion (Misc queries) | |||
excel and background colour | Setting up and Configuration of Excel | |||
excel and no background colour | Excel Discussion (Misc queries) |