Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to count formated Cells in Excel Macro

I used a Macro to format cells based on given criteria. But now I need
a Macro to count those formatted cells and print them in a seperate
cell. I want to to use the count feature but I can't figure out how to
just count the formatted cells. This is the Macro I used to format the
cells based on the criteria:

Sub P2()


Dim LastRow As Long
Dim iRow As Long


With ActiveSheet
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row


For iRow = 3 To LastRow
If .Range("C" & iRow).Value < .Range("H" & iRow).Value Then
.Range("H" & iRow).Interior.Color = RGB(200, 160, 35)
End If
Next iRow
End With
End Sub



Anybody got any ideas????????????

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default Need to count formated Cells in Excel Macro

See http://www.xldynamic.com/source/xld.ColourCounter.html for a working
solution

--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

wrote in message
oups.com...
I used a Macro to format cells based on given criteria. But now I need
a Macro to count those formatted cells and print them in a seperate
cell. I want to to use the count feature but I can't figure out how to
just count the formatted cells. This is the Macro I used to format the
cells based on the criteria:

Sub P2()


Dim LastRow As Long
Dim iRow As Long


With ActiveSheet
LastRow = .Cells(.Rows.Count, "C").End(xlUp).Row


For iRow = 3 To LastRow
If .Range("C" & iRow).Value < .Range("H" & iRow).Value Then
.Range("H" & iRow).Interior.Color = RGB(200, 160, 35)
End If
Next iRow
End With
End Sub



Anybody got any ideas????????????



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default Need to count formated Cells in Excel Macro

I came up with this and it works fine. Thanks.


Sub P3()

Dim c As Range
Dim i As Long


For Each c In ActiveSheet.UsedRange
If c.Interior.ColorIndex = 45 Then
i = i + 1
End If
Next


Range("H945").Value = i



End Sub

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
if condition on currency formated cells Narnimar Excel Discussion (Misc queries) 4 November 22nd 08 03:19 PM
I'm looking to add cells (that are formated in %) in them. j5b9721 Excel Worksheet Functions 5 July 17th 07 04:16 AM
Don't Want to Print Formated Blanked Out Cells GPIE Excel Discussion (Misc queries) 1 March 15th 07 04:09 PM
CONCATENATE Cells Formated as fractions Northcoast Excel Worksheet Functions 4 April 27th 06 05:24 PM
Counting Formated Cells birdismyers Excel Programming 2 October 22nd 03 02:18 AM


All times are GMT +1. The time now is 01:49 AM.

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

About Us

"It's about Microsoft Excel"