I Wrote this code. I dont understand why I got error : End If without block If
Sub mytest()
Dim i As Integer
Dim s As Integer
Dim j As Integer
Dim p As Integer
Dim k As Integer
s = 0
With Worksheets("mysheet")
.Range("B28:B75").Select
For i = 28 To 75
If Cells(i, 2).Value > 0 Then Cells(i, 2).Interior.Color = RGB(255, 255, 255)
s = s + 1
End If
Next i
.Range("A28:A75").Select
For j = 28 To 75
If Cells(i, 2).Value = 0 Then Cells(i, 2).Interior.Pattern = xlPatternLightDown
Cells(i, 2).Interior.Color = RGB(255, 255, 255)
End If
Next j
p = 75 - s
For k = 1 To s
Cells(s + k, 1).Interior.Color = RGB(18, 0, 0)
Next k
End With
The End If clause wasnt omitted. I dont understand why I got error
Thenon new lineBlock If without End IfbutEnd If without block If. You don't have an missingEnd If, you have too much ;) (see answer from Macro man below or this answer ) .