Using this code it takes almost 30 seconds to complete work on 100 rows and 150 column my data is increasing swiftly and soon code will take more time to initiate. please guide me what is wrong with this code.
Sub Colourise()
Dim r As Long, Val As String, C As Long
Worksheets("Assets").Activate
r = 1
Val = ActiveSheet.Cells(r, 43).Value
C = 6 '6 is yellow, 8 is cyan
For r = 1 To ActiveSheet.Rows.Count
IsEmpty(ActiveSheet.Cells(r, 43).Value) Then ' column 43 is client name
Exit For
End If
If ActiveSheet.Cells(r, 43).Value <> Val Then
If C = 8 Then
C = 6
Else
C = 8
End If
End If
ActiveSheet.Range(Cells(r, 1), Cells(r, 80)).Select ' column 80 is end of data
With Selection.Interior
.ColorIndex = C
.Pattern = xlSolid
End With
Val = ActiveSheet.Cells(r, 43).Value
Next
End Sub