• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA function not auto updating

Saitej1234

New Member
I have written a function in vba for sum based on cell interior colour.
But when i fill colour to another cell in the selected range then sum is not auto updating.
When i click on sum colour cell then it is updating.
Please help to auto update the sum when i add color to cell in given range.
 

Attachments

Hui

Excel Ninja
Staff member
If you are only applying it to a small range you could try the example to monitor cell colors described here
 

Saitej1234

New Member
>>> use code - tags <<<
Code:
Function sumcolor(cellcolor as range, rRange as range)
Dim csum as double
Dim colindex as integer
Colindex= cellcolor.interior.colorindex
For each cl in rRange
If cl.interior.colorindex=colindex then
Csum= worksheetfunction.sum(cl,csum)
End if
Next cl
Sumcolor= csum
End function
This is the code i have witten
 
Last edited by a moderator:
Top