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 dilemma!!


Thanks form the reply david, my count by color only if a date exist
works fine, it's the cntbycolor if cell contains text not #N/A over
different range that does not work.....i have tried and tried bu
cannot get it to work!

Any thoughts?


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=27633

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,758
Default Counting by colour dilemma!!

Your CntByColor code won't work. You can only return a value to the worksheet
that holds the formula.

So when you try to do this:
Range("B6").Value = Range("B6").Value - 1
It'll blow up real good!

I'm not quite sure I understand, but maybe this'll be closer:

Option Explicit

Function CntByColor(InRange As Range, WhatColorIndex As Integer, _
Optional OfText As Boolean = False) As Long

Dim Rng As Range
Application.Volatile True

For Each Rng In InRange.Cells
If Rng.Text = "#N/A" Then
'do nothing
Else
If OfText = True Then
CntByColor = CntByColor - _
(Rng.Font.ColorIndex = WhatColorIndex)
Else
CntByColor = CntByColor - _
(Rng.Interior.ColorIndex = WhatColorIndex)
End If
End If

Next Rng

End Function



Simon Lloyd wrote:

Thanks form the reply david, my count by color only if a date exists
works fine, it's the cntbycolor if cell contains text not #N/A over a
different range that does not work.....i have tried and tried but
cannot get it to work!

Any thoughts?

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=276337


--

Dave Peterson
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 by colour davethewelder Excel Discussion (Misc queries) 6 August 20th 08 10:14 AM
Counting colour fills Jonah Excel Discussion (Misc queries) 2 December 21st 06 01:11 AM
Counting by colour dilemma!! Simon Lloyd[_604_] Excel Programming 1 November 9th 04 01:55 AM
Counting by colour dilemma!! crispbd[_17_] Excel Programming 0 November 8th 04 07:51 PM
Counting Function Dilemma Simon Lloyd Excel Worksheet Functions 0 November 8th 04 03:13 PM


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