Greetings
I have a coloring in issue:
I have a sheet, and in column A there are JobIDs with same grouped number A1=1, A2=1, A3=1, A4=3 ,A5=3 ,A6=3.
I currently have this: which color codes the batches correctly.
Issue 1: It works for 56 lines and dies probably because I'm using cindex. It needs to run for as many group IDs I have in the A column.
Issue 2: It works only in row 1, I need to it work from A:Z.
Also it would be lovely to have only 2 colors instead of working down the entire color pallet
Thanks guys!
I have a coloring in issue:
I have a sheet, and in column A there are JobIDs with same grouped number A1=1, A2=1, A3=1, A4=3 ,A5=3 ,A6=3.
I currently have this: which color codes the batches correctly.
Issue 1: It works for 56 lines and dies probably because I'm using cindex. It needs to run for as many group IDs I have in the A column.
Issue 2: It works only in row 1, I need to it work from A:Z.
Also it would be lovely to have only 2 colors instead of working down the entire color pallet
Thanks guys!
Code:
Sub dupColors()
On Error Resume Next
Dim i As Long, cIndex As Long
cIndex = 37
Cells(1, 1).Interior.ColorIndex = cIndex
For i = 1 To Cells(Rows.Count, 1).End(xlUp).Row
If Cells(i, 1) = Cells(i + 1, 1) Then
Cells(i + 1, 1).Interior.ColorIndex = cIndex
Else
If Cells(i + 1, 1) <> "" Then
cIndex = cIndex + 1
Cells(i + 1, 1).Interior.ColorIndex = cIndex
End If
End If
Next i
On Error GoTo 0
End Sub