如何修复“编译错误:对象必需”错误?

时间:2022-10-16 10:10:32

This is my very first time with VBA. For the following code fragment:

这是我第一次使用VBA。对于以下代码片段:

Dim i As Integer
    Set i = 0
    For Each v In dictDT.Keys
        Cells(10, 5 + i) = dictDT.Item(v)
        i = i + 1
    Next

I keep getting this error:

我一直收到这个错误:

Compile Error: Object Required

What am I doing wrong?

我究竟做错了什么?

1 个解决方案

#1


11  

Change

更改

Set i = 0

to

i = 0

Only objects require the Set keyword. Other variable types do not.

只有对象需要Set关键字。其他变量类型则没有。

#1


11  

Change

更改

Set i = 0

to

i = 0

Only objects require the Set keyword. Other variable types do not.

只有对象需要Set关键字。其他变量类型则没有。