Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I want to be able to use this macro: Function SumByColor(InRange As Range, WhatColorIndex As Integer, _ Optional OfText As Boolean = False) As Double ' ' This function return the SUM of the values of cells in ' InRange with a background color, or if OfText is True a ' font color, equal to WhatColorIndex. ' Dim Rng As Range Dim OK As Boolean Application.Volatile True For Each Rng In InRange.Cells If OfText = True Then OK = (Rng.Font.ColorIndex = WhatColorIndex) Else OK = (Rng.Interior.ColorIndex = WhatColorIndex) End If If OK And IsNumeric(Rng.Value) Then SumByColor = SumByColor + Rng.Value End If Next Rng End Function In my workbooks. How do I do it, or where do I put it? As you can probably tell, I have no clue how macros or VB work, jus thought I'd jump in and ask the question.... Many thanks in advance, Chri -- Tibb ----------------------------------------------------------------------- Tibbs's Profile: http://www.excelforum.com/member.php...fo&userid=1594 View this thread: http://www.excelforum.com/showthread.php?threadid=27427 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Newbie Macro Question | Excel Discussion (Misc queries) | |||
Real Newbie newbie question | New Users to Excel | |||
total dumb newbie question | Excel Discussion (Misc queries) | |||
Total question (macro?) | Excel Programming | |||
VBA question involving an InputBox | Excel Programming |