من قبل
nizar eid , رئيس حسابات , شركة الانطلاق لتجارةالاجهزه الطبيه
يمكن عمل ذلك من خلال VBA بالصيغة ادناه
Sub color()
For x =15 To24
For Each cell In Sheet1.Range("b4:g13")
If cell.Interior.ColorIndex = Sheet1.Cells(x,2).Interior.ColorIndex Then
Sheet1.Cells(x,3) = Sheet1.Cells(x,3) + cell.Value
End If
Next
Next
End Sub
من قبل
Feras Hassan , ERP Manager , Manaseer Machinery Trading
Add the below macro and then use it to sum( use minus to subtract)
ALT + F11
Microsoft Visual Basic for application
Insert - Module
copy the below and paste it the click Run
Function SUMCOLOR(rColor As Range, rSumRange As Range)
Dim rCell As Range
Dim iCol As Integer
Dim vResult
Application.Volatile
iCol = rColor.Interior.ColorIndex
For Each rCell In rSumRange
If rCell.Interior.ColorIndex = iCol Then
vResult = WorksheetFunction.SUM(rCell) + vResult
End If
Next rCell
SUMCOLOR = vResult
End Function