【问题标题】:How to fix "Compile Error: Object Required" error?如何修复“编译错误:需要对象”错误?
【发布时间】:2012-07-19 02:03:30
【问题描述】:

这是我第一次使用 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

我不断收到此错误:

Compile Error: Object Required

我做错了什么?

【问题讨论】:

  • 我的VB不是最新的,所以我问:你需要为v指定一个type吗?

标签: vba excel


【解决方案1】:

改变

Set i = 0

到

i = 0

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2021-12-09
    • 1970-01-01
    • 1970-01-01
    • 2014-03-11
    • 2018-02-27
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多