LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 37
Default SumByColor Macro...

I am using the following Macro - the formula I use to access the macro is

=sumBYCOLOR(C13:H22,3,TRUE)

The problem I am having is that the formula does not automatically calculate
no information inputted into the excel sheet. I have to go to the cell with
the formula and place my cursor at the end of the formula and hit enter for
it to adjust with the new information. Any help?

Macro is: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

 
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
SumByColor & #NAME? Ty Excel Worksheet Functions 7 August 12th 11 01:14 AM
sumbycolor formula Danielah21 Excel Worksheet Functions 1 July 3rd 08 01:01 PM
SumByColor Stopped Working Pattylb Excel Worksheet Functions 2 April 9th 08 08:02 PM
how to use sumbycolor fuction? Ghauri Excel Worksheet Functions 2 November 29th 05 09:00 PM
Start Macro / Stop Macro / Restart Macro Pete[_13_] Excel Programming 2 November 21st 03 05:04 PM


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