ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Worksheet Functions (https://www.excelbanter.com/excel-worksheet-functions/)
-   -   How many rows are coloured (https://www.excelbanter.com/excel-worksheet-functions/445445-how-many-rows-coloured.html)

Moideen

Please help me to get count of colored excel Rows
 
Hi,

Please help me to get count of colored excel Rows

Data Having 125 Rows, Row No : 50 and Row No : 75 are colored with blue

When opening the file Need Message How many rows are colored

Please Help me.

Spencer101

Quote:

Originally Posted by Moideen (Post 1599689)
Hai,

Please help me to get count rows of coloured.

Data Having 125 Rows, Row No : 50 and Row No : 75 are coloured with blue

Need MSG on Row1 "2 Rows are colored" is there any function in excel 2007 for this.

You'll be needing a "User Defined Function" then...

Try this.
http://www.ozgrid.com/VBA/sum-count-cells-by-color.htm

Vacuum Sealed

How many rows are coloured
 
On 12/03/2012 5:22 AM, Moideen wrote:
Hai,

Please help me to get count rows of coloured.

Data Having 125 Rows, Row No : 50 and Row No : 75 are coloured with
blue

Need MSG on Row1 "2 Rows are colored" is there any function in excel
2007 for this.





Hi

There is most likely a better code out there, I have seen one, just
can't locate it, that said! I have tested the below and it does the job
well ( assuming you are using the standard Blue = 12611584 ).

Record a Macro and change a cell to your desired color and change the
code to reflect.

Sub CountColor()

Dim tCell As Range 'Total colored Cells
Dim hRng As Range 'Helper Count Range
Dim myRng As Range 'Range of Column A
Dim c As Range

Set tCell = [A1] 'Displays Total color Cells
Set hRng = Range("B2:B10") '**Change Range to suit
Set myRng = Range("A2:A10") 'Change Range to suit

For Each c In myRng
If c.Interior.Color = 12611584 Then
c.Offset(0, 1).Value = 1 '**Change number of Columns to offset
End If
Next c

tCell = WorksheetFunction.Sum(hRng) & " Cells are Colored"

End Sub

HTH
Mick.



All times are GMT +1. The time now is 02:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com