|
代码如下。。。。
Sub Demo()
Dim wb As Workbook, sht As Worksheet
Set wb = ThisWorkbook
Set d = CreateObject("scripting.dictionary")
For i = 0 To 999
s = "'" & Format(i, "000")
d(s) = ""
Next
With wb.Sheets("sheet1")
arr = .Range(.[b2], .Cells(.Rows.Count, 4).End(3))
m = 0
ReDim brr(1 To 100000, 1 To 1000)
For i = 1 To UBound(arr)
n = 0: m = m + 1
For j = 1 To Len(arr(i, 1))
s = Mid(arr(i, 1), j, 1)
For k = 1 To Len(arr(i, 2))
ss = Mid(arr(i, 2), k, 1)
For l = 1 To Len(arr(i, 3))
sss = Mid(arr(i, 3), l, 1)
n = n + 1
brr(n, m) = "'" & s & ss & sss
If d.exists(brr(n, m)) Then d.Remove brr(n, m)
x = Application.Max(x, n)
Next
Next
Next
Next
.[f2].Resize(x, m) = brr
.[p2].Resize(d.Count) = Application.Transpose(d.keys)
End With
Set d = Nothing
Beep
End Sub
|
|