I am working on vba macros. I was trying to use a dictionary. But it is giving error 457
with debugger pointing to toprow.Add ActiveCell.value, val
. Can anyone please tell the issue? I even used Cstr(activecell.value), Cstr(val)
as mentioned in one of the answer on similar issue.
Dim toprow As New Dictionary, Dictkey As Variant
Dim val As String
Range("A1").Activate
i = 0
Do Until i = ColLen
val = Chr(65 + i)
toprow.Add ActiveCell.value, val
i = i + 1
ActiveCell.Offset(0, 1).Activate
Loop
ActiveCell.value
is not unique, i.e. there is at leasta duplicated value in theA
column. – McardleActiveCell.Offset(1, 0)
instead ofActiveCell.Offset(0, 1)
. – Mcardle