How to fix the "Compile Error: Object Required" error?

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

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?

+3
source share
1 answer

Edit

Set i = 0

to

i = 0

Only objects require the Set keyword. Other types of variables do not.

+11
source

Source: https://habr.com/ru/post/1780906/


All Articles