|
分類:[.NET 全般]
Private a As Integer, b As Integer, c As Integer, d As Integer, e As Integer, f As Integer _ , g As Integer, x As Integer Sub hw11()
For a = 1 To 45 For b = 1 To 45
c = Int((Rnd * 25.5)) * 10 d = Int((Rnd * 25.5)) * 10 e = Int((Rnd * 25.5)) * 10
Sheet1.Cells(a, b).Interior.Color = RGB(c, c, c)
Next b
Next a
For a = 1 To 45 For b = 1 To 45
Sheet2.Cells(a, b).Interior.Color = RGB(g, g, g) f = MAX(c, d, e)
Next b Next a
End Sub
Function MAX(ByVal a As Integer, b As Integer, c As Integer)
If c > d Then If c > e Then g = c Else g = e End If
Else g = d End If
End Function Sheet1に45×45のセルにランダムに色を付けて、 その後、Sheet2に上記の画像(?)を強度画像(各セルのRGBの値のうち最も高い値の白黒色に変換)に変換、出力するプログラムを作りたいのですが、実行するとSheet2のセルの色が全て同じになってしまいます。 どこが悪いのか教えてください。よろしくおねがいします
|