|
- Sub zz()
- Dim d As Object, ar, b(), s$, k, t, rp As Object
- Set rp = CreateObject("vbscript.regexp")
- Set d = CreateObject("scripting.dictionary")
- rp.Pattern = "\d+"
- ar = Sheets(2).[a236].CurrentRegion.Value
- For i = 2 To UBound(ar)
- d(ar(i, 1)) = ar(i, 2)
- Next
- With Sheets(1)
- ar = .Range("b2:b" & .[b1048576].End(3).Row).Value
- ReDim b(1 To UBound(ar), 1 To 10)
- For i = 1 To UBound(ar)
- If Len(ar(i, 1)) > 0 Then
- s = Split(ar(i, 1), "|")(0)
- k = Split(s & Replace(ar(i, 1), "-", "|", Len(s) + 1), "|")
- For j = 0 To 2
- b(i, j + 1) = k(j)
- Next
- b(i, j + 1) = rp.Replace(k(j), "")
- b(i, j + 2) = Replace(k(j), b(i, j + 1), "")
- For j = 4 To UBound(k)
- b(i, j + 2) = k(j)
- Next
- b(i, j + 2) = d(b(i, 1))
- b(i, j + 3) = i
- End If
- Next
- End With
- [e2].Resize(i - 1).NumberFormat = 0
- [d2].Resize(i - 1, 10) = b
- End Sub
复制代码 |
|