好久没有来充数了,废话也是要写写的。
终于稍微尝到了一点OO的甜头。因为一直用不好OO,一直逃避,能不用就不用。正则什么的,都是没办法了才用。这次为了页面和代码的简单易懂,在不重复List的问题上,还是选择了字典法。
'********************************APT vs TPT
Dim DicTest As Object
'Here apply non dup by dictionary method
Set DicTest = CreateObject("scripting.dictionary")
For i = 2 To Sheet6.UsedRange.Rows.Count
If Trim(Sheet6.Cells(i, 2)) = "3.Test File Received" Then
x = Trim(Sheet6.Cells(i, 3).Value) & "||" & Trim(Sheet6.Cells(i, 8).Value)
If Not DicTest.exists(x) Then
DicTest.Add x, x
End If
End If
Next i
krr = DicTest.items
arr = DicTest.items
brr = DicTest.items
For i = 0 To UBound(krr)
arr(i) = Split(krr(i), "||")(0)
brr(i) = Split(krr(i), "||")(1)
Next i
For k = 0 To UBound(krr)
If arr(k) = "APT" Then
sAPT = sAPT + 1
End If
If arr(k) = "TPT" Then
sTPT = sTPT + 1
End If
Next k
If (sTPT + sAPT) <> DicTest.Count Then
MsgBox "Some file type may not be entered by DRM, please check!"
Exit Sub
End If
'********************Start preparing table @ sheet7