|
GYUHJ 发表于 2012-5-10 20:09
我不懂,找了相似代码的意思
...
也可以啊:
Sub test()
Dim B1(), B2(), BRR(), CRR()
Set D = CreateObject("scripting.dictionary")
For I = 1 To 4
ARR = Sheets(I).Range("D15:D40")
For J = 1 To UBound(ARR)
If ARR(J, 1) <> "" Then
If Not D.exists(ARR(J, 1)) Then
D.Add ARR(J, 1), 1
Else
D(ARR(J, 1)) = D(ARR(J, 1)) + 1
End If
End If
Next
Next
K = D.keys
For I = 0 To UBound(K)
If D(K(I)) > 2 And D(K(I)) < 7 Then
N1 = N1 + 1
ReDim Preserve B1(1 To N1)
B1(N1) = K(I)
End If
If D(K(I)) > 0 And D(K(I)) < 5 Then
N2 = N2 + 1
ReDim Preserve B2(1 To N2)
B2(N2) = K(I)
End If
Next
C1 = Range("T15").End(1).Column
If C1 < 14 Then
C1 = 14
Else
C1 = C1 + 1
End If
C2 = Range("AA15").End(1).Column
If C2 < 22 Then
C2 = 22
Else
C2 = C2 + 1
End If
Cells(15, C1).Resize(N1, 1) = Application.Transpose(B1)
Cells(15, C2).Resize(N2, 1) = Application.Transpose(B2)
End Sub
|
|