代码改变世界

vba 去除数组重复数据

2016-06-06 13:53  sylar_liang  阅读(3916)  评论(0编辑  收藏  举报

Dim intArr()

Dim strL As string

 

Dim BB As new Collection

for i = LBound(varFileList) To UBound(varFileList)

  strTemp1 = varFileList(i)

  strL = Mid(strTemp1, 1, inStr(strTemp1, "-")-1)

  nL = Cint(strL)

  BB.Add varFileList(i), Str(varFileList(i))

  Next i

 

Redim Preserve intArr(BB.count)

  FOr i = 1 To BB.Count

    intArr(i) = BB(i)

    MsgBox intArr(i)

  Next