|
楼主 |
发表于 2018-7-12 22:11
|
显示全部楼层
本帖最后由 mqj80 于 2018-7-12 22:55 编辑
Sub test()
Dim Rng As Range, TopRow&
Set dic = CreateObject("scripting.dictionary")
With Sheet1
arr = .[a1].CurrentRegion
For i = 2 To UBound(arr)
If Not dic.exists(arr(i, 8)) Then
Set dic(arr(i, 8)) = CreateObject("scripting.dictionary")
End If
dic(arr(i, 8))(arr(i, 1)) = dic(arr(i, 8))(arr(i, 1)) & "|" & arr(i, 1)
Next i
For i = 2 To UBound(arr)
If arr(i, 1) = "进行中" Then
mm = Join(dic(arr(i, 8)).Keys, "-")
If InStr(mm, "完结") = 0 Then
If Rng Is Nothing Then
Set Rng = Range("a" & i).Resize(1, UBound(arr, 2))
Else
Set Rng = Union(Rng, Range("a" & i).Resize(1, UBound(arr, 2)))
End If
End If
End If
Next i
End With
With Sheet2
If Not Rng Is Nothing Then
TopRow = .Cells(.Rows.Count, 2).End(3).Row + 1
Rng.Copy .Range ("a" & TopRow) 报错 无法复制
End If
End With
End Sub
|
|