LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 40
Default How to count number of red font cells or rows

OK !!

I have it working; really appreciate the help.

I amended my original code;

Sub test2()

Let b = 0

For a = 4 To 870
If Cells(a, 11).Font.Color < 0 Then Let b = b + 1
Next a

Cells(873, 10) = b

End Sub

It counted the number of non automatic colored cells, just as your idea was,
and it gave an answer of 117, which is what I wanted!

Thanks.

If you or anyone can find why the code didn't work, then please let me know.




"RajenRajput1" wrote:

Thank you,

I tried both options, Joel and Incidental.

Joel, sorry, it didn't work.

And Incidental, it gave me a count of 867. That is the same as 870-4
(inclusive).

I have triple checked, and the font color is red and the stated font color
number (index) is correct.

I like the idea of counting the non black cells, it makes sense, but it is
saying that they all are, when they are not.

I still require a little help.

Thanks

"Incidental" wrote:

Hi

the code below is one way of doing what your after.

Option Explicit
Dim MyCell, MyRng As Range
Dim i As Integer

Sub CountReds()

Set MyRng = Range("A4:A870")

For Each MyCell In MyRng

If MyCell.Font.ColorIndex = 3 Then

i = i + 1

End If

Next MyCell

Cells(873, 10) = i

End Sub

Hope this helps

Steve

 
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 number of rows with 2 matching text cells smcmoran Excel Worksheet Functions 5 September 29th 08 05:53 PM
How to count number of Cell have Strike Through Effect & Bold as font style. Akash Maheshwari Excel Discussion (Misc queries) 6 June 29th 07 09:39 PM
How to count number of Cell have Strike Through Effect & Bold as font style. Akash Excel Programming 10 June 28th 07 06:28 AM
Count cells with strikethrough font? Mike Echo Excel Worksheet Functions 2 November 4th 05 08:42 AM
how do I count cells with only red font? wayne Excel Discussion (Misc queries) 1 June 24th 05 06:29 AM


All times are GMT +1. The time now is 12:15 AM.

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"