AUTO SUM ONLY SPECIFIC COLORED CELLS BY CONDITIONAL FORMATING

  • Thread starter abu abdullah........halsaeed85
  • Start date
A

abu abdullah........halsaeed85

HI EVERY ONE
I HAVE THIS EVENT CODE FOR SUMMING DEFINED RANGE

Private Sub Worksheet_Change(ByVal Target As Range)
Dim RNG1 As Range
Dim RNG2 As Range
Set RNG1 = Range("D2:D20")
Set RNG2 = Range("D21")
If Not Intersect(RNG1, Target) Is Nothing Then
RNG2.Value = Application.WorksheetFunction.Sum(RNG1)
End If
End Sub


BUT WHAT I NEED URGENT TO ADD A CONDITION TO SUM (ONLY) AS EXAMPLE ALL
Cells.Interior.ColorIndex = 3 I CONTROL WITH CELLS COLOR WITH
CONDITIONAL FORMATING I HOPE ITS VERY CLAER , I HOPE ANY ONE CAN HELP
APPRECIATED
 
P

p45cal

Conditional formatting does not change the .interior.colorindex property
of a cell. You need to look at the formula(e) which determines whether
to colour the cell red (usually colorindex of 3) and use that with sumif
or the like.

What formula determines a .colorindex of 3 in CF?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top