View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Toppers Toppers is offline
external usenet poster
 
Posts: 4,339
Default Chequer-box Pattern

Try this:


Sub chequer()
Dim i As Long, cell As Range, r As Long, c As Long, j As Long
i = 0
For r = 1 To 100
For c = 1 To 26
i = i + 1
j = (i - Int((i / 2)) * 2)
Cells(r, c).Interior.ColorIndex = j * 13 + 2
Next
i = i + 1 ' Force Alternate colour at beginning of next row
Next
End Sub

HTH
"Stuart" wrote:

With the range ("A1:Z100") in the activesheet, I would like to create
alternating patterns in the cells using
ColorIndexes 2 and 15.
So A1=2 B1=15 C1=2
And A2=15 B2=2 C2=15 etc

How best to do this, please?

Regards.