简单循环中的预期数组

时间:2016-05-18 07:58:36

标签: vba excel-vba excel

请你能找到什么问题吗? 我有简单的VBA makro,但仍然是预期的阵列。

Dim C_1 As Double 
Dim C_2 As Double

    For k = 1 To 6
        C_1(k) = 19
        C_2(k) = 11
    Next k

     For k = 7 To 11
        C_1(k) = 29
        C_2(k) = 19
    Next k

非常感谢

1 个答案:

答案 0 :(得分:1)

您没有将变量声明为数组。你需要:

Dim C_1(1 to 11) As Double 
Dim C_2(1 to 11) As Double