我在模块中编写了一个简单的函数,如下所示:
Function allocate(ByVal pq As PriceQtyClass, ByVal al As AllocationClass) As Boolean
Dim tmpRange As Range
Dim tmpDic As Dictionary
Dim rowIndex As Integer
Set tmpDic = pq.priQtyDic
Set tmpRange = Application.ActiveCell.Offset(0, 1)
rowIndex = 1
For Each k In tmpDic
set tmpRange = k 'adding set here isnot working
rowIndex = rowIndex + 1
Next
End Function
当它转到 tmpRange = k 时,弹出“未定义用户定义类型”的消息!
我不知道这是为什么,哪里错了!
请帮忙!