Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am looking for a way to count the number of Red Cells on a worksheet and
return that number is a message box. Thanks in advance! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Something along these lines should work.
If cells are colored by conditional format: For Each c In myRange If c.FormatConditions.Interior.ColorIndex = 3 Then 'Do something End If If cells are colored by standard format or code: For Each c In myRange If c.Interior.ColorIndex = 3 Then 'Do something End If "Aaron" wrote: I am looking for a way to count the number of Red Cells on a worksheet and return that number is a message box. Thanks in advance! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You realize, of course, that is not complete code.
"Aaron" wrote: I am looking for a way to count the number of Red Cells on a worksheet and return that number is a message box. Thanks in advance! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Here is code that will work if the cells are red by standard format method.
Sub cntclr() Count = 0 For Each C In Worksheets(1).Range("A1:F20") 'Change range for needs. If C.Interior.ColorIndex = 3 Then Count = Count + 1 End If Next MsgBox Count End Sub "Aaron" wrote: I am looking for a way to count the number of Red Cells on a worksheet and return that number is a message box. Thanks in advance! |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
What if it is a conditional formatting that turns the cell red??
"JLGWhiz" wrote: Here is code that will work if the cells are red by standard format method. Sub cntclr() Count = 0 For Each C In Worksheets(1).Range("A1:F20") 'Change range for needs. If C.Interior.ColorIndex = 3 Then Count = Count + 1 End If Next MsgBox Count End Sub "Aaron" wrote: I am looking for a way to count the number of Red Cells on a worksheet and return that number is a message box. Thanks in advance! |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() "Aaron" wrote: What if it is a conditional formatting that turns the cell red?? In that case you just insert the FormatConditions property like: Sub cntclr() Count = 0 For Each C In Worksheets(1).Range("A1:F20") 'Change range for needs. If C.FormatConditions.Interior.ColorIndex = 3 Then Count = Count + 1 End If Next MsgBox Count End Sub "JLGWhiz" wrote: Here is code that will work if the cells are red by standard format method. Sub cntclr() Count = 0 For Each C In Worksheets(1).Range("A1:F20") 'Change range for needs. If C.Interior.ColorIndex = 3 Then Count = Count + 1 End If Next MsgBox Count End Sub "Aaron" wrote: I am looking for a way to count the number of Red Cells on a worksheet and return that number is a message box. Thanks in advance! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
how to count#cells w/= value in other column and not count blank c | Excel Worksheet Functions | |||
How to count two cells occurrences in a worksheet | Excel Worksheet Functions | |||
how to count non blank cells from another worksheet | Excel Discussion (Misc queries) | |||
Count of Worksheet rows and recording this count | Excel Programming | |||
Using the COUNT funciton to count cells with values | Excel Programming |