Sumit
Posted: Sun Aug 23, 2020 6:38 am
Hi There
I wrote code to sum Color values using sub routine but it is not working fine,why?
Here below an attachment
I wrote code to sum Color values using sub routine but it is not working fine,why?
Code: Select all
Sub SumColorValues()
Dim Num As Long
Num=0
Dim lR As Long,i As Long
With Sheet1
lR=.Range("A"&Rows.Count).End(xlUp).Row
For i=2 To lR
If .Range("A"&i).Interior.ColorIndex=
.Range("E"&i).Interior.ColorIndex Then
Num=Num+.Range("A"&i).Value
End If
Next
.Range("F"&i).Value=Num
End With
End Sub