Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
Alicia
 
Posts: n/a
Default Is there a way to count the number of highlighted cells in a col?

I have a column with about 8000 cells, all with different words in each cell.
Some cells are highlighted, some are not. I would like to know how many
cells are highlighted. Is there a way to count them or sort by highlighted
versus non-highlighted?
  #2   Report Post  
Posted to microsoft.public.excel.misc
Bernard Liengme
 
Posts: n/a
Default Is there a way to count the number of highlighted cells in a col?

Chip has something about counting be colour; www.cpearson.com
best wishes
--
Bernard V Liengme
www.stfx.ca/people/bliengme
remove caps from email

"Alicia" wrote in message
...
I have a column with about 8000 cells, all with different words in each
cell.
Some cells are highlighted, some are not. I would like to know how many
cells are highlighted. Is there a way to count them or sort by
highlighted
versus non-highlighted?



  #3   Report Post  
Posted to microsoft.public.excel.misc
trav
 
Posts: n/a
Default Is there a way to count the number of highlighted cells in a col?


I think this will work, just copy and paste it into a module, either
your personal or for the workbook,


Code:
--------------------

Sub count_colored()
Dim CountCol, IndexCol, currentrow, CurrentCount, RepStartRow As Integer
Dim sheetname As String
Dim endofreport As Boolean

sheetname = ActiveSheet.Name
CountCol = 4 'column that holds the colored cells
IndexCol = 5 'Column that holds number index
RepStartRow = 2 'row number where the report data starts
endofreport = False 'signal "end of report"
currentrow = RepStartRow 'current row number
CurrentCount = 0
'Selection.Value = Selection.Interior.ColorIndex
'Worksheets(sheetname).Cells(2, 2)

While endofreport = False
Do
If Worksheets(sheetname).Cells(currentrow, CountCol).Value = "" And _
Worksheets(sheetname).Cells(currentrow + 1, CountCol).Value = "" And _
Worksheets(sheetname).Cells(currentrow + 2, CountCol).Value = "" And _
Worksheets(sheetname).Cells(currentrow + 3, CountCol).Value = "" Then

Worksheets(sheetname).Cells(currentrow, CountCol - 1).Value = "Number of colored Cells"
Worksheets(sheetname).Cells(currentrow, CountCol).Value = CurrentCount
endofreport = True 'for blank cells mean end of page end of page
Else
If Worksheets(sheetname).Cells(currentrow, CountCol).Interior.ColorIndex = 0 Then
'do some stuff
CurrentCount = CurrentCount + 1

End If



End If
currentrow = currentrow + 1

Loop Until endofreport
Wend
End Sub

--------------------


you can change the column number and row number,
also you can put the sum of the count anywhere you want, i just put it
at the bottom.

also if you want you can even count differnt colors.

let me know if this helped
Trav


--
trav
------------------------------------------------------------------------
trav's Profile: http://www.excelforum.com/member.php...o&userid=31420
View this thread: http://www.excelforum.com/showthread...hreadid=515845

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
count highlighted cells PASSWORD37 Excel Discussion (Misc queries) 1 February 7th 06 04:34 AM
How do I count number of cells with info?? HJK Excel Discussion (Misc queries) 3 September 20th 05 07:11 AM
Count the number of Cells in one ROW with conditions Amanda Excel Worksheet Functions 2 September 9th 05 04:03 PM
How do I count cells that have are highlighted a certain color? NicoleE Excel Worksheet Functions 1 September 2nd 05 09:14 PM
how do I 'count' the number of cells with a text in red or black? Anjin Topeng Excel Worksheet Functions 2 November 4th 04 06:42 AM


All times are GMT +1. The time now is 04:35 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"