ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Highlighting (https://www.excelbanter.com/excel-programming/277971-highlighting.html)

Lisa[_8_]

Highlighting
 
I have a report with multiple columns and rows, this is
reviewed for errors and any that are found are highlighted
yellow. What I am wanting to do is be able to say "count
any cell highlighted in yellow and sum" Does anyone know
if this can be done or am I just dreaming??

Filip Mateasko

Highlighting
 
Hi Lisa,
try this:

Sub CountYellow()

Dim counter As Integer
Dim r As Range
counter = 0

Set r = Range("A1", Range("A1").SpecialCells(xlLastCell))
For Each c In r.cells
If c.Interior.ColorIndex = 6 Then counter = counter + 1
Next
MsgBox counter
End Sub


Maybe you will need to change the Colorindex, it depends on which yellow you
use.
You can also modify the MsgBox to show you some additional informations ;-)

Regards
Filip



"Lisa" píse v diskusním príspevku
...
I have a report with multiple columns and rows, this is
reviewed for errors and any that are found are highlighted
yellow. What I am wanting to do is be able to say "count
any cell highlighted in yellow and sum" Does anyone know
if this can be done or am I just dreaming??





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

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