Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Travis Littlechilds
 
Posts: n/a
Default A way to refresh a certain cell everytime wroksheet changes

I'm using a fuction I found on the net called countcolor (included at bottom
of post.) I've got it working on my schedule I'm making, and it counts up how
many closers and suppers and whatnot, but the problem is if I change a cell
and the color changes, the count doesn't change until I go into the cell and
hit enter to reenter the formula, is there a way to refresh this cell
automatically every time the worksheet is updated?


Function CountColor(Rng As Range, RngColor As Range) As Integer

Dim Cll As Range
Dim Clr As Long

Clr = RngColor.Range("A1").Interior.Color

For Each Cll In Rng
If Cll.Interior.Color = Clr Then
CountColor = CountColor + 1
End If
Next Cll

End Function

  #2   Report Post  
Arvi Laanemets
 
Posts: n/a
Default

Hi

there are 2 ways.

1.
Function CountColor(Rng As Range, RngColor As Range) As Integer
Dim Cll As Range
Dim Clr As Long

Application.Volatile
.....

2.
Function CountColor(Rng As Range, RngColor As Range,Optional TestTime As
Date) As Integer
Dim Cll As Range
Dim Clr As Long
.....

With second approach, when you want to use the function as volatile, you
enter the formula p.e. in form
=COUNTCOLOR(YourRange, ColorToCount, NOW())
When you dont want the formula to act as volatile, you simply drop 3rd
parameter.

--
Arvi Laanemets
( My real mail address: arvil<attarkon.ee )




"Travis Littlechilds" wrote
in message ...
I'm using a fuction I found on the net called countcolor (included at
bottom
of post.) I've got it working on my schedule I'm making, and it counts up
how
many closers and suppers and whatnot, but the problem is if I change a
cell
and the color changes, the count doesn't change until I go into the cell
and
hit enter to reenter the formula, is there a way to refresh this cell
automatically every time the worksheet is updated?


Function CountColor(Rng As Range, RngColor As Range) As Integer

Dim Cll As Range
Dim Clr As Long

Clr = RngColor.Range("A1").Interior.Color

For Each Cll In Rng
If Cll.Interior.Color = Clr Then
CountColor = CountColor + 1
End If
Next Cll

End Function



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
SQL - Auto Refresh Upon Cell Value Change Elliot J Excel Worksheet Functions 1 May 12th 05 10:22 AM
how to create a variable column in cell reference Sampson Excel Worksheet Functions 3 February 21st 05 10:13 PM
Can a Formula in Cell X modify Cell Y? alMandragor Excel Discussion (Misc queries) 7 February 10th 05 09:51 PM
inserting data from a row to a cell, when the row number is specified by a formula in a cell [email protected] New Users to Excel 2 January 6th 05 07:18 AM
VLookup resulting in a blank cell... KempensBoerke Excel Worksheet Functions 1 October 28th 04 09:57 PM


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