|
代码如下。。。
Private Sub CommandButton1_Click()
Worksheets("表1").Range("A2:A10000").ClearContents
Worksheets("表2").Range("A2:A10000").ClearContents
Dim dict As Object, Arr, condition As String, i As Long
Set dict = CreateObject("scripting.dictionary")
Set dict1 = CreateObject("scripting.dictionary")
condition = Worksheets("表1").Range("A1")
With Worksheets("单号")
Arr = .Range(.Range("D4"), .Cells(Rows.Count, "bu").End(xlUp))
For i = 1 To UBound(Arr, 1)
If Arr(i, 1) = condition And Arr(i, 70) = "否" Then
dict(Arr(i, 21)) = "'" & Arr(i, 21)
End If
If Arr(i, 70) = "否" Then
dict1(Arr(i, 21)) = "'" & Arr(i, 21)
End If
Next i
End With
Worksheets("表1").Range("A2").Resize(dict.Count, 1) = Application.Transpose(dict.items)
Worksheets("表2").Range("A2").Resize(dict1.Count, 1) = Application.Transpose(dict1.items)
Set dict = Nothing
Set dict1 = Nothing
Beep
End Sub
|
评分
-
1
查看全部评分
-
|