VBA Chess Board without MOD

This entry is just for myself in case I forgot what I wrote for my VBA assignment.

I was asked to create a chess board in Microsoft using VBA. I admit I googled the solution but all I found was a solution that used "MOD". My professor didn't teach us how to use "MOD", which meant I couldn't use that code.

Anyway, this is what I came up with.
Sub Chess()
For a = 1 To 8
Cells(a, 1).Offset(0, a - 1).Interior.Color = black
Next a
For b = 3 To 8
Cells(b, 1).Offset(0, b - 3).Interior.Color = black
Next b
For c = 5 To 8
Cells(c, 1).Offset(0, c - 5).Interior.Color = black
Next c
For d = 7 To 8
Cells(d, 1).Offset(0, d - 7).Interior.Color = black
Next d
For e = 1 To 6
Cells(e, 3).Offset(0, e - 1).Interior.Color = black
Next e
For f = 1 To 4
Cells(f, 5).Offset(0, f - 1).Interior.Color = black
Next f
For g = 1 To 2
Cells(g, 7).Offset(0, g - 1).Interior.Color = black
Next g
End Sub
Cheers,
MNS

Comments

Popular posts from this blog

ေက်ာင္းေကာင္စီ သီခ်င္း

A Friend of Convenience