柳暗花明笔记

    vba 添加对数组的重复检验

    所属分类:[ 杂七杂八 ] 猫哲学家 发表于:2016-12-31 17:13 浏览:599

    Set orderIDSKUdict = CreateObject("Scripting.Dictionary")

    For p = 0 To UBound(fl)
    Set wb = Workbooks.Open(fl(p))
    r = wb.Sheets(1).Cells(Rows.Count, 5).End(xlUp).Row
    arr = wb.Sheets(1).Range("a1:af" & r)

    For ii = 2 To r
    OrderID = wb.Sheets(1).Cells(ii, 5)
    SKU = wb.Sheets(1).Cells(ii, 8)
    NewStr = OrderID & "-" & SKU
    If orderIDSKUdict.Exists(NewStr) Then
    MsgBox "有重复数据:OrderID " & OrderID & ", SKU " & SKU & "请检查数据"
    wb.Close
    Exit Sub
    Else
    orderIDSKUdict.Add NewStr, NewStr
    End If
    Next ii
    Next
    wb.Close


    上一编文章 ubuntu 安装最新的flash player 下一编文章 nginx 查找配置文件的方法
    最近文章
    发表评论