|
代码简化一下。
- Sub ykcbf() '//2024.12.5
- Application.ScreenUpdating = False
- Set d = CreateObject("Scripting.Dictionary")
- p = ThisWorkbook.Path & ""
- f = p & "测试文本2.txt"
- Open f For Input As #1
- zrr = Split(StrConv(InputB(LOF(1), 1), vbUnicode), vbCrLf)
- Close #1
- On Error Resume Next
- For i = 0 To UBound(zrr)
- If InStr(zrr(i), "就职") Then
- r1 = i
- s = zrr(r1 + 1) & "|" & zrr(r1 + 2)
- d(s) = Array(zrr(r1 + 3), zrr(r1 + 4))
- i = i + 4
- End If
- Next
- r = Cells(Rows.Count, 1).End(3).Row
- arr = [a1].Resize(r, 8)
- For i = 3 To UBound(arr)
- s = Replace(arr(i, 2), Chr(13), "") & "|" & Replace(arr(i, 3), Chr(13), "")
- If d.exists(s) Then
- arr(i, 4) = d(s)(0)
- arr(i, 5) = d(s)(1)
- End If
- Next
- Columns(4).NumberFormatLocal = "@"
- [a1].Resize(r, 8) = arr
- Set d = Nothing
- Application.ScreenUpdating = True
- MsgBox "OK!"
- End Sub
复制代码
|
评分
-
2
查看全部评分
-
|