LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 9
Default Suggestion for a macro?

Hey everyone,
Ok this is going to be a detailed description so if it is a little
confusing so bare with me. My macro experience is nothing more than beginner
also so any sort of help will be much appreciated. What I have is a building
entry pass list of about 250 people and 5 different categories that people
are defined with.

What I need is a macro that will count the number of cells, that have a
specific background color and display the results in a single cell below the
range. I.E. One of the categories is "Need Deleted" and has a red background
color. There are 5 different colors and 6 different columns. Each column of
names has a spacer column between it (This is where some of my problems
arise). The way the spread sheet is setup, the results are in a range of
there own with the specific amount for each color displays for the
corresponding column. As of right now i have a COLORFUNCTION equation in
there that counts them but it doesn't automatically update the result when
you change the color. (EX. =ColorFunction(D57,E5:E54,FALSE)).

A guy I work with found this macro but I can't seem to get it working
because, well I just don't have that much experience with macros (It is a
general macro and nothing is defined specifically yet.):

Function ColorFunction(rColor As Range, rRange As Range, Optional SUM As
Boolean)
Dim rCell As Range
Dim lCol As Long
Dim vResult

''''''''''''''''''''''''''''''''''''''
'Written by Ozgrid Business Applications
'www.ozgrid.com

'Sums or counts cells based on a specified fill color.
'''''''''''''''''''''''''''''''''''''''

lCol = rColor.Interior.ColorIndex

If SUM = True Then
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = WorksheetFunction.SUM(rCell, vResult)
End If
Next rCell
Else
For Each rCell In rRange
If rCell.Interior.ColorIndex = lCol Then
vResult = 1 + vResult
End If
Next rCell
End If

ColorFunction = vResult
End Function


I took one look at that and got confused about all the ranges and such. I
am wondering if anyone has any ideas on if i can use this macro or if there
is a better route to the solution, or if I am just using the colorfunction
wrong and it is on my end that it is not automatically updating when i change
the color. Thanks a lot in advance for any help received.

Cheers,
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
Newbie seeks suggestion on recording new macro to print sheets Vivian New Users to Excel 2 May 10th 06 06:53 AM
Suggestion IGFET909 Excel Worksheet Functions 5 April 4th 06 08:57 PM
Suggestion about a formula Elkar Excel Discussion (Misc queries) 0 November 9th 05 07:18 PM
Suggestion about a formula Nelly Excel Discussion (Misc queries) 0 November 9th 05 07:18 PM
Suggestion on this one? Dale Meredith Excel Discussion (Misc queries) 1 August 12th 05 12:36 AM


All times are GMT +1. The time now is 03:10 PM.

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"