|
本帖最后由 gxp1986 于 2020-1-10 10:34 编辑
- Sub test()
- Dim dic As Object
- Set dic = CreateObject("Scripting.Dictionary")
- With Sheet2
- For i = 1 To 10000
- If .Cells(i, 2) = "" Then Exit For
- dic(.Cells(i, 2).Value) = .Cells(i, 1).Value
- Next
- End With
- Dim reg As Object
- Set reg = CreateObject("VbScript.regexp")
- With reg
- .Global = True
- .IgnoreCase = False
- .Pattern = "ZDK\d\+\d+"
- End With
- Dim rn, n As Long, j As Long
- For i = 2 To 10000
- If Cells(i, 1) = "" Then Exit For
- Set rn = reg.Execute(Cells(i, 1).Value)
- n = rn.Count
- If n > 0 Then
- n = n - 1
- For j = 0 To n
- Cells(i, j + 2) = rn(j) & ":" & dic(rn(j).Value)
- Next
- End If
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|