Excel VBA 質問スレ Part19

このエントリーをはてなブックマークに追加
132じゃが山さん
〜問題〜
いろいろとエスパーして???を埋めなさい(15点)

Sub tyokusen(sx, sy, ex, ey)
Dim a, b, c, d, e, f, g, z
f = 1
If sx > ex Then f = -1
g = 1
If sy > ey Then g = -1
a = sx
b = sy
If Abs(ex - sx) < Abs(ey - sy) Then
c = Abs((ex - sx) / (ey - sy))
d = 0.5
Do
d = d + c
If d > 1 Then
d = d - 1
a = a + f
End If
b = b + g
Cells(b, a).Interior.Color = 0
If b = ey Then Exit Sub
Loop
Else
???
End If
End Sub