請問各位,該如何順利蝸牛程式碼呢
目前寫到這裡
Sub 蝸牛()
Dim empty_fill_color_code As Long
Dim R1 As Long
Dim C1 As Long
R1 = 20: C1 = 20
ColorNumber = Round(Rnd(1) * 17895696, 0)
empty_fill_color_code = Cells(1, 1).Interior.Color
End Sub
分開會寫偵測轉向程式碼
Sub 蝸牛()
Dim empty_fill_color_code As Long
Dim R1 As Long
Dim C1 As Long
R1 = 20: C1 = 0
ColorNumber = Round(Rnd(1) * 17895696, 0)
empty_fill_color_code = Cells(1, 1).Interior.Color
For i = 1 To 20
C1 = i
Cells(R1, C1).Select
If Cells(R1 + 1, C1).Interior.Color = empty_fill_color_code Then
Exit For
End If
Next
Cells(R1 + 1, C1).Interior.Color = ColorNumber
End Sub
但不知道該如何合併才能順利畫出像費氏蝸牛圖那樣
希望有人能幫忙解答,謝謝