I have some data where I have colored certain Values.
I want to write a code that would Sum only if the Color Index is 37.
I have attached the sheet as well as the code.
Can anyone clarify what is wrong?
Code =
Sub Colorindex()
Dim LR As Integer, Counter As Byte, GT As Double
ThisWorkbook.Sheets("Sheet1").Activate
LR = Sheets("Sheet1").Cells(Rows.Count, 1).End(xlUp).Row
For Counter = 1 To LR
GT = Application.WorksheetFunction.SumIf(Range("A1:A" & LR), Range("A" & Counter).Interior.Colorindex = 37, (Range("A1:A" & LR)))
Next Counter
End Sub
Bookmarks