|
发表于 2018-9-15 17:46
来自手机
|
显示全部楼层
本帖最后由 lss001 于 2018-9-16 15:40 编辑
Function QCHP(qu As Range, Optional tjqu, Optional tj = "")
If IsMissing(tjqu) Then Set rng = Range("B3:B" & qu.Count)
If Not IsMissing(tjqu) Then Set rng = tjqu
ar = qu: cr = rng
For k = UBound(ar) To 1 Step -1
If ar(k, 1) <> "" Then Exit For
Next
Set d = CreateObject("scripting.dictionary")
For i = k To 1 Step -1
If tj = "" Then
If ar(i, 1) <> "" Then d(ar(i, 1)) = ""
Else
If ar(i, 1) <> "" And cr(i, 1) = tj Then d(ar(i, 1)) = ""
End If
Next
nx = Application.Transpose(d.Keys)
ReDim br(1 To UBound(ar), 1 To 1)
For i = 1 To UBound(ar)
If i < d.Count + 1 Then br(i, 1) = nx(i, 1) Else br(i, 1) = ""
Next
QCHP = Application.Transpose(br)
End Function |
评分
-
2
查看全部评分
-
|