Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 493
Default 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
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
Sheet Background Colour Kaye Excel Discussion (Misc queries) 2 February 12th 07 02:15 AM
change a cell background colour to my own RGB colour requirements Stephen Doughty Excel Discussion (Misc queries) 4 June 16th 06 01:08 PM
change background colour cityfc Excel Discussion (Misc queries) 1 November 11th 05 01:03 PM
excel and background colour anonymous Setting up and Configuration of Excel 1 April 5th 05 04:58 PM
excel and no background colour anonymous Excel Discussion (Misc queries) 1 April 5th 05 12:32 AM


All times are GMT +1. The time now is 10:47 PM.

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"