|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
代码供参考。。。
- Sub ykcbf() '//2024.3.27
- Set d = CreateObject("Scripting.Dictionary")
- r = Cells(Rows.Count, "g").End(3).Row
- brr = [g1].Resize(r, 1)
- n = 1
- For i = 1 To r
- If InStr(brr(i, 1), "<hmc>") Then
- n = n + 1
- st1 = brr(i + 1, 1): c1 = InStr(st1, "/") - InStr(st1, ">") - 2
- st2 = brr(i + 2, 1): c2 = InStr(st2, "/") - InStr(st2, ">") - 2
- d(n) = Array(Mid(st1, InStr(st1, ">") + 1, c1), Mid(brr(i + 2, 1), InStr(st2, ">") + 1, c2))
- End If
- Next
- r = Cells(Rows.Count, "a").End(3).Row
- arr = [a1].Resize(r, 4)
- For i = 2 To UBound(arr)
- If arr(i, 3) <> Empty Then
- arr(i, 3) = d(i)(0)
- arr(i, 4) = d(i)(1)
- End If
- Next
- [a1].Resize(r, 4) = arr
- Set d = Nothing
- MsgBox "OK!"
- End Sub
复制代码
|
|