Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default counting by colour only if a cell contains a date???


Sorry Peter you have lost me here!, can you explain what it was you wer
trying to get me to do?

Simo

--
Simon Lloy
-----------------------------------------------------------------------
Simon Lloyd's Profile: http://www.excelforum.com/member.php...nfo&userid=670
View this thread: http://www.excelforum.com/showthread.php?threadid=27311

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default counting by colour only if a cell contains a date???

Function CountByColor(InRange As Range, _
WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long
'
' This function return the number of cells in InRange with
' a background color, or if OfText is True a font color,
' equal to WhatColorIndex.
'
Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
if isdate(rng) then
If OfText = True Then
CountByColor = CountByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CountByColor = CountByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
End if
Next Rng

End Function

--
Regards,
Tom Ogilvy



"Simon Lloyd" wrote in message
...

Sorry Peter you have lost me here!, can you explain what it was you were
trying to get me to do?

Simon


--
Simon Lloyd
------------------------------------------------------------------------
Simon Lloyd's Profile:

http://www.excelforum.com/member.php...fo&userid=6708
View this thread: http://www.excelforum.com/showthread...hreadid=273115



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default counting by colour only if a cell contains a date???


Sorry Peter you have lost me here!, can you explain what it was you were
trying to get me to do?


In your previous post you asked:
i am unsure how to add a line to the code
that will follow the criteria if activecell.value = Date then count


and in reply I suggested IsDate(ActiveCell)

But I can see now I misread your question, sorry!
I thought you wanted to check if the cell contain a valid date rather than
than if the cell contains today's date.

Regards,
Peter


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
counting cell that are fomated a particular fill colour Andrew@rushington[_2_] Excel Discussion (Misc queries) 8 December 7th 07 10:40 PM
After a cell changes colour when a date is near cityfc Excel Discussion (Misc queries) 3 January 10th 06 03:58 PM
How can i change cell colour depending on month of date in cell? andy75 Excel Discussion (Misc queries) 2 January 6th 06 07:46 AM
counting by colour only if a cell contains a date??? Simon Lloyd[_597_] Excel Programming 1 October 29th 04 12:32 PM
counting by colour only if a cell contains a date??? Simon Lloyd[_594_] Excel Programming 1 October 28th 04 01:32 PM


All times are GMT +1. The time now is 12:39 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"