Hi,
I have changed your code as follows :
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
If Sheets("Sheet1").Cells(Counter, 1).Interior.Colorindex = 37 Then
GT = GT + Sheets("Sheet1").Cells(Counter, 1)
End If
'GT = Application.WorksheetFunction.SumIf(Range("A1:A" & LR), Range("A" & Counter).Interior.Colorindex = 37, (Range("A1:A" & LR)))
Next Counter
MsgBox GT
End Sub
Bookmarks