请教各位高手,有关Scripting Dictionary的问题,选择不重复的结果
Function RandomN(rng As Range, numbers)Dim results()
ReDim results(numbers)
Dim i As Integer
For i = 0 To numbers - 1
results(i) = rng.Cells(WorksheetFunction.RandBetween(1, rng.Count))
Dim duplicateitem As New Scripting.Dictionary
Dim v
v = rng.Cells(WorksheetFunction.RandBetween(1, rng.cunt))
For Each duplicateitem In rng
If duplicateitem = results(i) Then
i = i + 1
End If
Next
Next
RandomN = WorksheetFunction.Transpose(results)
End Function
我想自己定义一个函数 RandomN(B1:B50,5),从B1:B50里返回5个不重复的任意值,这段代码错在哪里?
运行的时候,错误提示说,子函数过程未定义,我不都定义了么? scripting dictionary function --------------------编程问答-------------------- 在References把excel分析工具库的那几个文件都加上。
补充:VB , VBA