|
Sub 按钮1_Click()
Set d = CreateObject("scripting.dictionary")
arr = Application.Intersect(Columns("c:d"), ActiveSheet.UsedRange)
ReDim crr(1 To UBound(arr) * UBound(arr), 1 To 1)
For j = 1 To UBound(arr)
If Len(arr(j, 2)) > 0 Then
x = Left(arr(j, 2), 1)
If Not d.exists(x) Then
Set d(x) = CreateObject("scripting.dictionary")
End If
d(x)(j) = arr(j, 2)
Else
Exit For
End If
Next j
r = 0
For j = 1 To UBound(arr)
If Len(arr(j, 1)) > 0 Then
x = Right(arr(j, 1), 1)
If d.exists(x) Then
For Each k In d(x).keys
r = r + 1
crr(r, 1) = arr(j, 1) & Mid(d(x)(k), 3)
Next k
End If
Else
Exit For
End If
Next j
[f1].Resize(r) = crr
End Sub
|
|