只是好奇但有没有办法将其减少到较少的代码行?
For k = 1 To 12
Select Case k
Case 1
col = 9
Case 2
col = 10
Case 3
col = 11
Case 4
col = 12
Case 5
col = 13
Case 6
col = 14
Case 7
col = 15
Case 8
col = 16
Case 9
col = 17
Case 10
col = 18
Case 11
col = 19
Case 12
col = 20
End Select
Next
谢谢!
答案 0 :(得分:2)
怎么样:
For k = 1 to 12
col = k + 8
Next
或者您可能正在寻找的东西:
For k = 1 To 12
Select Case k
Case 1 To 12
col = k + 8
End Select
Next
这是relevant MSDN,您可以向下滚动以查看示例。