# Fill 3 different colours every Step7

#### motilulla

##### Well-known Member
</SPAN></SPAN>Hello,</SPAN></SPAN>

Need a VBA, which can fill 3 different colours every Step7 as long as data find in the columns C:D </SPAN></SPAN>
Note: colours must be different in both C & D column as shown in the Example...</SPAN></SPAN>

Book1
ABCD
1
2
3
4
5n1n2
655
766
855
955
1066
1155
1266
1366
1466
1577
1655
1766
1877
1977
2066
2155
2266
2366
2455
2577
2666
2766
2855
2955
3077
Sheet1

Thank you all</SPAN></SPAN>

Excel 2000</SPAN></SPAN>
Regards,</SPAN>
Moti</SPAN></SPAN>

Last edited:

### Excel Facts

Will the fill handle fill 1, 2, 3?
Yes! Type 1 in a cell. Hold down Ctrl while you drag the fill handle.
Code:
``````Sub Motilulla()
Dim i As Long, Clr As Long

For i = 6 To Range("C" & Rows.Count).End(xlUp).Row Step 7
With Range("C" & i).Resize(7)
Clr = (i Mod 3) + 37
.Interior.ColorIndex = Clr
.Offset(, 1).Interior.ColorIndex = IIf(Clr = 39, 37, Clr + 1)
End With
Next i
End Sub``````

Code:
``````Sub Motilulla()
Dim i As Long, Clr As Long

For i = 6 To Range("C" & Rows.Count).End(xlUp).Row Step 7
With Range("C" & i).Resize(7)
Clr = (i Mod 3) + 37
.Interior.ColorIndex = Clr
.Offset(, 1).Interior.ColorIndex = IIf(Clr = 39, 37, Clr + 1)
End With
Next i
End Sub``````
Thank you Fluff, I liked the colours combination too will keep them as it is. Solved!</SPAN></SPAN>

Kind Regards,
</SPAN></SPAN>
Moti
</SPAN></SPAN>

You're welcome & thanks for the feedback

Replies
1
Views
103
Replies
8
Views
604
Replies
0
Views
187
Replies
10
Views
462
Replies
2
Views
165

1,202,908
Messages
6,052,488
Members
444,587
Latest member
ezza59

### We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.

### Which adblocker are you using?

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

### Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

### Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back