RAJAQ
12/2/2016 - 10:55 AM

For Next Loop with End If statement > checkerboard

For Next Loop with End If statement > checkerboard

Sub MakeCheckerboard()

    Dim Row As Integer
    Dim Col As Integer
    
        For Row = 1 To 8
            If WorksheetFunction.IsOdd(Row) Then
                For Col = 2 To 8 Step 2
                    Cells(Row, Col).Interior.Color = RGB(200, 200, 200)
                Next Col
            Else
                For Col = 1 To 8 Step 2
                    Cells(Row, Col).Interior.Color = RGB(200, 200, 200)
                Next Col
            End If
        Next Row
        
End Sub