Fill 3 different colours every Step7

motilulla

Well-known Member
Joined
Feb 13, 2008
Messages
2,422
Office Version
  1. 2010
</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

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
How about
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
 
Upvote 0
How about
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>
 
Upvote 0
You're welcome & thanks for the feedback
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,284
Members
452,630
Latest member
OdubiYouth

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.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

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

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

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
Back
Top