作者s963870 (flare0118)
看板Visual_Basic
標題[VBA ] Array宣告問題
時間Tue May 31 22:47:59 2011
Sub SwapBlank(BtnNo As Variant)
Dim i As Integer
Dim Neighbors
Neighbors = Array(Array("2","4"),_
Array("1","3","5"),_
Array("2","6"),_
Array("1","5","7"),_
Array("2","4","6","8"),_
Array("3","5","9"),_
Array("4","8"),_
Array("5","7","9"),_
Array("6","8"))
If Controls("CommandButton"& BtnNo).Caption<>""Then
For i = 1 To UBound(Neibors(BtnNo))
If Controls("CommandButton"&Neighbors(BtnNo)(i)).Caption = "" Then
Controls("CommandButton"&Neighbors(BtnNo)(i)).Caption =
Controls("CommandButton"&BtnNo).Caption)
Controls("CommandButton"&BtnNo).Caption = ""
Exit For
End If
Next i
End If
End Sub
可以請問這樣ARRAY宣告部分有錯誤嗎? 錯的話應該怎麼訂正??
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 125.233.146.192
※ s963870:轉錄至看板 Programming 05/31 22:51
1F:→ MOONRAKER:底線前面要有空格。 06/01 00:37
2F:→ s963870:感謝樓上 宣告成功了 06/01 08:35