I want to have alternate backgrd colour for different text
I wrote a code for it and there are several errors. How can I improve it? Thanks
Sub Alternatecolour()
Flag = True
lr = Cells(Rows.Count, 1).End(xlUp).Row
Startcl = Cells(2, "D")
For Each cl In Range("D2:D" & lr)
str1 = cl.Text
str2 = cl.Offset(-1, 0).Text
Diff = StrComp(str1, str2, vbBinaryCompare)
If Diff = 0 Then
GoTo Loopend
End If
If Diff <> 0 Then
If Flag = True Then
Range(Startcl, cl).Interior.Color = 15
Startcl = cl
Flag = False
Else
Range(Startcl, cl).Interior.Color = 16
Startcl = cl
Flag = True
End If
End If
Loopend
Next cl
End Sub


LoopendbeforeNext clshoud beLoopend:GoToand I encourage you to do so.